Jeff Polakow <[EMAIL PROTECTED]> writes:

> 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
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to