Non-monolithic version of 'sequence' for IO monad?
Malcolm Wallace
Malcolm.Wallace@cs.york.ac.uk
Tue, 6 Nov 2001 13:34:17 +0000
>| I seem to be able to give it an
>| infinite list of computations and yet start receiving
>| results immediately....
> This is not true, as the following example demonstrates:
>
> main :: IO ()
> main = sequence [ return i | i <- [1..] ] >>= print
You are right. I was confused between the visible results of the
action and the functional result. For example,
sequence [ print i | i <- [1..] ]
outputs the numbers to screen immediately, but never produces a value.
Regards,
Malcolm