On Wed, Jul 30, 2008 at 4:18 AM, Wei Hu <[EMAIL PROTECTED]> wrote:
> Thanks for pointing out the sharing part. My original question is still
> unanswered: for lazy monads, can we give such a general mfix definition?

I dunno.  I played around with your definition and the mfix laws, and
was unable to get anywhere.

  * mfix (return . h) = return (fix h)

  * mfix (\x -> a >>= \y -> f x y) = \y -> mfix (\x -> f x y)

  * if h is strict,  mfix (liftM h . f) = liftM h (mfix (f . h))

  * mfix (\x -> mfix (\y -> f x y)) = mfix (\x -> f x x)

But I think this is the way to approach it.  There are many kinds of
"lazy monads", so presumably an exploration of this form will help
characterize the kinds of monads for which this definition does work.

Luke
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to