[Haskell-cafe] Monad Description For Imperative Programmer
ok
ok at cs.otago.ac.nz
Thu Aug 2 01:57:25 EDT 2007
On 2 Aug 2007, at 1:20 pm, Alexis Hazell wrote:
> Category theorists can define monads concisely using the language
> of their
> discipline - surely we can settle on a definition of Haskell Monads
> that
> would make sense to any programmer who has mastered basic programming
> concepts?
It all depends on what you mean "make sense to".
I can tell my student that (an instance of Monad) is a type constructor
applications of which support certain operations that must satisfy
certain
operations. They can memorise that. But it remains meaningless
noise to
them. What matters is not what monads *ARE* but what they are *FOR*.
Why should anyone care what monads are until they know why monads
matter?
One of my colleagues here, who has worked in logic for many years, is
fond
of saying that there are "set theory" people who like to have their
feet on
the ground and "category theory" people who like to have their heads
in the
air. There's no dispute that you get a much better view with your
head in
the air; there is no dispute that the general definitions and
understandings
of monads have power and utility. Me, I'm a set theory person. I
have no
trouble with fields, got my head around tensors and Lie groups (or very
nearly), and I even know what a fibre bundle is (got an A for that).
All of
this is *grounded*. But I have repeatedly hit category theory and as
repeatedly bounced. Chapter 1? No trouble. Chapter 2? No trouble.
Chapter 3? Bounce.
If a "category theory" person wants to understand monads, they will be
happy with an abstract approach and work down from there. But if a
"set theory" person wants to understand monads, they have to start with
simple specific cases. The IO monad first. The ST monad. Then perhaps
Maybe and []. And then start learning about monad transformers. The
understanding of monads as such will grow out of this; by the time they
are ready to cope with these compact high level definitions people are
talking about they won't need it any more.
I don't have any numbers. It would be interesting if someone did a
survey.
But I suspect that "category theory" people are a minority even among
functional programmers. How many O'Caml programmers worry about the
definition of monads?
So go on arguing about how to define monads for Haskell, but consider
your audience.
More information about the Haskell-Cafe
mailing list