
15 Apr
2015
15 Apr
'15
4:44 p.m.
Note that these do not correspond to the Strict and Lazy State in transformers. The former (which you call lazy) corresponds to Strict from transformers. The lazier version uses lazy pattern matching in bind.
I knew I was going to make a mistake somewhere :). The problem is they are transformers and i wanted an example without transformers to confuse the issue So what would be a correct lazy version?? instance Monad (State s) where act1 >>= f2 = State $ \s1 -> runState (f2 (fst res)) (snd res) where res = runState act1 s1 instance Monad (State s) where act1 >>= f2 = State $ \s1 -> runState (f2 input2) s2 where ~(input2, s2) = runState act1 s1 These should do the same right? Silvio