
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: 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