[Haskell-cafe] Monad explanation

Jonathan Cast jonathanccast at fastmail.fm
Thu Feb 5 15:14:39 EST 2009

On Thu, 2009-02-05 at 20:46 +0100, Lennart Augustsson wrote:
> 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.

Technically, programs don't do anything either.  I think of values of
type IO a as being --- conceptually --- arbitrary sequences of machine
code instructions.  Just like a sequence of machine code instructions
can be stored away in /bin/cat, and not do anything, an IO value needn't
do anything, either.  Until it's stored in memory and the instruction
pointer set to its first instruction.  At which point, if you want to
get really picky, it's still the CPU doing things.  Which it is told to
do by its fixed microcode.  Which tells it to look at your program to
see what to do.  Which = looking at the `value' of your IO-typed
expression to see what to do.


More information about the Haskell-Cafe mailing list