[Haskell-cafe] Re: Can we come out of a monad?

Anton van Straaten anton at appsolutions.com
Fri Jul 30 06:44:32 EDT 2010


Kevin Jardine wrote:
> I think that we are having a terminology confusion here. For me, a
> pure function is one that does not operate inside a monad. Eg. ++,
> map, etc.

Ivan Miljenovic has already given a good response, to which I'll only 
add this:

I suspect that your idea of the meaning of purity came from 
over-generalization from the IO monad.  IO actions may be impure, but 
that's not true of all other monad types.  (Most are actually pure.)

Really, the IO monad is a horrible exception to normal monadic behavior, 
and in an ideal world it should only be introduced as a special case 
after gaining a good understanding of monads in general.

Of course in practice, people like their programs to be able to do I/O, 
so the IO monad ends up being one of the first things learned.

It's a bit like teaching a new carpenter about the concept of "tools", 
and then starting them out with a chainsaw, leading to the natural 
conclusion that tools are loud, insanely dangerous things.

Anton



More information about the Haskell-Cafe mailing list