
On Thu, Feb 5, 2009 at 1:46 PM, Lennart Augustsson
You are absolutely right. The statement "The values of the IO monad are programs that do IO. " is somewhat nonsensical. Values don't do anything, they just are.
Whew! So I'm not crazy. I was starting to wonder.
But values of the IO monad *describe* how to do IO; they can be seen as a recipe for doing IO. A recipe doesn't cook a dish, but when the recipe is executed by a cook they creates a dish. An IO values doesn't do IO, but when it is executed by the runtime system IO happens.
This is one way of interpreting what the IO type means. (Another one is to say that Haskell is just an imperative programming language, but any imperative actions show up in the type.)
Thanks very much to you and everybody who contributed on the thread. It's amazing how much one can learn on this list. -gregg