Is there any way, short of using unsafePerformIO,
to implement a combinator
f :: [IO a] -> IO [a]
in a way that the the result is produced lazily?
The problem with
sequence :: (Monad m) => [m a] -> m [a]
sequence = foldr (liftM2 (:)) (return []) where
liftM2 f a b = do { a' <- a; b' <- b; return (f a' b') }
is that it consumes the entire input before producing a result.
Thanks for any advice,
--Joe English
jenglish@flightlab.com