> But I think the reasons behind lazy pattern usage in the mplus
> implementation are similar to those behind lazy pattern usage in the (>>=)
> implementation.

I find the explanation of "Lazy patterns are useful in contexts where
infinite data structures are being defined recursively" is easier to
understand. Actually all the lazy pattern examples I have seen so far
belong to this category. Here I want to correct a statement I made
previously about:

  mplus m1 m2       = do  ...
                        ~(a,s') <- lift (mplus m1' m2')

In one of my emails to the thread I mentioned m1/m2 and m1'/m2' could
be different Monads so mplus works differently (so that this is not
exactly a recusrive data structure), but even so the lazy pattern
works. The problem is when m1/m2 and m1'/m2' are of the same Monad
type, then the problem of recursive definition comes up and this is
the place lazy patterns are particularly useful.

Thanks,
Fan
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to