
31 Oct
2007
31 Oct
'07
8:22 a.m.
Jeff Polakow
Besides anything else, sequence will diverge on an infinite list.
Argh, of course. Thanks!
It is necessary to compute all of the computations in the list before returning any of the pure resulting list.
Replacing sequence with sequence', given as:
sequence' ms = foldr k (return []) ms where k m m' = do { x <- m; xs <- unsafeInterleaveIO m'; return (x:xs) }
seems to solve it. -k -- If I haven't seen further, it is by standing in the footprints of giants