[Haskell-cafe] Monad explanation

Richard O'Keefe ok at cs.otago.ac.nz
Sun Feb 8 19:39:00 EST 2009


On 6 Feb 2009, at 5:08 am, Gregg Reynolds wrote:
> Not "programs", but "programs that do IO".  The point of the idiom  
> is that there's an external side effect involved.  What sticks in my  
> craw is that "a mathematical value with a non-mathematical side  
> effect" is, well, non-mathematical and possibly nonsensical.

I was introduced to group theory by being shown a real physical
cube (a child's building block) and the real physical actions of
turning a cube around in physical space that left it looking like
the same cube in the same place.  These physical actions are
the elements of a group because
	the action "don't do anything" is the identity
	the combination rule "do X then do Y" is multiplication
	for every action there is an obvious "undo" (or inverse) action
Take away the cube and the group remains: the elements of the group
are (representable as) mathematical objects and you can operate on those
mathematical objects to your heart's content.

Of course nothing actually happens in the real world until you
get a real cube and start following the instructions.

The analogy:
	Members of the symmetry group on a cube	: IO actions
::	an actual real world			: the IO state of a program
::	someone following the turning orders    : a Haskell system

is a good one.  If you want to say that "a mathematical value with
a non-mathematical effect" is nonsensical, more power to you.  I said
I don't want to get far into White Knight territory.  As long as you
can agree "A mathematical value INTERPRETED BY a physical engine can
have physical effects", we're home and dry.

Let's face it, the idea of a Haskell program having physical effects
(despite being a mathematical object) is no more (and no less)
"non-mathematical and possibly nonsensical" than the idea of a C
program (which is just a character string) having such effects,
and no more (and no less) "non-mathematical and possibly nonsensical"
than the idea of a machine code program (which is just a sequence of
bits) having such effects.  In all these cases, the program *is*
a perfectly good mathematical value, just as good as the number 1,
and arguably better than the number pi, and can be manipulated as
an mathematical value, even computed as the result of a mathematical
process.  In all these cases, the program cannot and will not have
any effects in the world whatsoever until it is combined with a
physical program-interpreting device.



Rem
>   I know it works for some (most?) people, but for me it lacks  
> Geometry and Theology.
>
> -g
>



More information about the Haskell-Cafe mailing list