[Haskell-cafe] Re: Monad explanation

Emilio Jesús Gallego Arias egallego at babel.ls.fi.upm.es
Mon Feb 9 18:50:06 EST 2009

Gregg Reynolds <dev at mobileink.com> writes:

> But it can't be a function, since it is non-deterministic.  

IMHO, if you assume IO a = World -> (World, a), then getChar is indeed a
function and deterministic. It is, there are not w :: World such that
getChar w != getChar.

The fact that World is too big to be represented in Haskell and we use
IO to simulate it is a different matter.

With regard to your original question, I like to keep in mind that
arrow composition in the Kleisli category (>>= in Haskell) is defined in
terms of the monad's join :: m (m a) -> m a.

Then, the question is, how many ways can you map an IO (IO a) to an IO

You will find that you cannot ignore the inner (first) IO in order to
obey monad laws.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20090210/b165595b/attachment.bin

More information about the Haskell-Cafe mailing list