Ticket #3454 (closed bug: invalid)

Opened 4 years ago

Last modified 4 years ago

ghci freezes on failed pattern match in recursive list comprehension

Reported by: Syzygies Owned by:
Priority: normal Milestone:
Component: Compiler Version: 6.10.4
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

The following freezes ghci (top shows no resources consumed):

Prelude> let xs = [1..5] : [ xt | (_:xt) <- xs ] in take 7 xs
[[1,2,3,4,5],[2,3,4,5],[3,4,5],[4,5],[5],[]

This is not the same issue as  http://hackage.haskell.org/trac/ghc/ticket/3053 (closed, invalid) as there are no elements to filter. (This may be a well-known black hole, but not to me; I was hoping a similar list would just terminate, trying to avoid the Nothing case boilerplate in an unfoldl.)

Change History

Changed 4 years ago by igloo

  • status changed from new to closed
  • difficulty set to Unknown
  • resolution set to invalid

The 7th element of cs is the tail of the first non-empty element after the 5th element of xs.

The 6th element is [], so that one can't be used.

So we need to look at whether or not the 7th element is [].

Thus this is a black hole.

Note: See TracTickets for help on using tickets.