[Haskell-cafe] Re: do

Luke Palmer lrpalmer at gmail.com
Tue Dec 4 06:50:05 EST 2007

On Dec 4, 2007 11:39 AM, Jules Bean <jules at jellybean.co.uk> wrote:
> Ben Franksen wrote:
> > I don't buy this. As has been noted by others before, IO is a very special
> > case, in that it can't be defined in Haskell itself, and there is no
> > evaluation function runIO :: IO a -> a.
> This is a straw man. Most monads will not have such a function:

When I first learned monads, I heard that "once you get into IO, you
can never get out".
The point here was that that doesn't generalize, so a student might
start thinking that
a monad is like a taint flag or something.  Not to say that statement
that it's a complete
falsity when generalized to other monads -- it's reflective of the
algebra of monads --
you just have to define "never" a little differently. :-)

In any case, I don't think that's a big issue.  While it is important
to eliminate things
that monads aren't from students' possible models, it's better just to
build a good model
in the first place.

FWIW, the list monad was how I made the leap from "monads do IO" to
"monads do nifty stuff".


> There is no function (State s a) -> a.
> There is no function (r -> a) -> a.
> There is no function (Random a) -> a. [assuming some random monad, often
> discussed]
> There is no function (Supply s a) -> a. [Another useful monad although
> not one of the standard ones]
> There are no (total) functions Maybe a -> a, [a] -> a, Either e a -> a.
> As to the topic of the thread: I agree IO is an unusual monad. I'm not
> sure if I agree that it shouldn't be used as a teaching basis. I think
> there are all kinds of ways to teach haskell; I'd be inclined to want to
> start with some IO, without explaining the plumbing in detail, and then
> come back to it later with better perspective when discussing general
> monads.
> Jules
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list