[Haskell-cafe] Monad Description For Imperative Programmer

Stuart Cook scook0 at gmail.com
Thu Aug 2 07:41:33 EDT 2007


On 8/2/07, Seth Gordon <sethg at ropine.com> wrote:
> Haskell solves the "how can I do I/O in a pure functional language"
> problem by *turning the world inside-out*.  Instead of taking data from
> the mutable outside world, using functions to manipulate it, and
> depositing results back into that world, you put your functions into the
> IO monad.

That's a very interesting perspective. One of the questions often
asked by Haskell newcomers is "how do I turn an IO a into an a?". The
correct answer is that you don't; instead, you use a function (a -> m
b) to indicate what you would have done with that a, and the bind
operator takes care of the messy details for you.


Stuart


More information about the Haskell-Cafe mailing list