On Tue, 2007-01-23 at 13:35 +0200, Yitzchak Gale wrote:
> <troll>
> 
> Prelude> let f .! g = ((.) $! f) $! g
> Prelude> let f = undefined :: Int -> IO Int
> Prelude> f `seq` 42
> *** Exception: Prelude.undefined
> Prelude> ((>>= f) . return) `seq` 42
> 42
> Prelude> ((>>= f) .! return) `seq` 42
> 42
> 
> </troll>

Perhaps I'm missing something but I don't see what's wrong.

I think what you're saying is that you want (>>=) to be strict in it's
second argument. I don't see that this is a requirement of the monad
laws.

You'll note that you get the same behaviour for other monads like Maybe
and [].

I recall that there is some infidelity in standard implementations of
the IO monad, but I don't think this is it.

Duncan

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

Reply via email to