return (replicate 1000000 'a') >>= \x->print $ spant (const True) x

ERROR - Garbage collection fails to reclaim sufficient space

i.e. as the function unfold, the thunk representing the second term builds up on the heap. (not sure why it works for an infinite list, hugs must drop the reference to the tail ?)

actually, that works because the infinite list has a finite representation,
being cyclic, so there's nothing to unfold:

return (repeat 'a') >>= \ x -> print $ span (const True) x

claus

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to