Lazy/Strict Monads (was: Non-monolithic version of 'sequence' for IO monad?)

Koen Claessen koen@cs.chalmers.se
Wed, 7 Nov 2001 17:34:16 +0100 (MET)


Josef Svenningsson wrote:

 | bind1 m f = \s -> let (s',a) = m s
 | 		  in f a s'
 :
 | bind2 m f = \s -> case m s of
 | 		   (s',a) -> f a s'

There are two more binds I would like to add to this list:

  bind3 m f = \s -> s `seq` bind1 m f s
  bind4 m f = \s -> s `seq` bind2 m f s

In other words, here we make sure that we have evaluated the
initial state completely before we continue. Could you
eleborate on these a little bit more?

/Koen.