
25 Sep
2007
25 Sep
'07
11:36 a.m.
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