
From your example I can see "Lazy patterns are useful in contexts where infinite data structures are being defined recursively" (quote
Hi Wolfgang, Thanks for your response and examples! It helps a lot. section 4.4 of Gentle Introduction to Haskell). But does it apply to the mplus case? I mean the mplus in (mplus m1 m2) and the mplus in (mplus m1' m2') are different due to the difference of Monads (one is StateT s m, the other is just m). If I change the mplus inside lift to something else like: mplus m1 m2 = do s <- peek let m1' = runState s m1 m2' = runState s m2 ~(a,s') <- lift (other_func m1' m2') poke s' return a Is it still required that (a,s') be lazy? I just want to see how things works in an less obvious example like this one. Thanks, Fan