Skip to content

ghci freezes on failed pattern match in recursive list comprehension

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.)

Trac metadata
Trac field Value
Version 6.10.4
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information