Tony Davie wrote:
| > class Monad m where
| > map :: (a -> b) -> (f a -> f b) -- Functor
| > return :: a -> m a -- Unit
| > (>>=) :: m a -> (a -> m b) -> m b -- Kleisli multiplication
| > or join :: m(m a) -> m a -- Monoid multiplication
| > -- Some axioms are missing here.
|
| I'm really worried about whether ordinary mortals (or at any rate
| programmers) will not be put off by these terms.
What terms do you mean?
For the programmer only _using_ Monads, nothing changes.
As stated earlier, we can get rid of the "map" part by defining Functor as
a superclass. Further, "join" can have a default definition in terms of
"map" and ">>=". For the programmer nothing changes, (s)he still only has
to define ">>=" and "return".
Not to mention the fact that the programmer now actually has the choice
of:
- or defining map, join and return;
- or defining map, >>= and return.
As I stated earlier, I (and I think also others) find it often easier to
define "join" than ">>=".
| It's all very well for mathematicians. Do we have to be mathematicians to
| make use of monoidal programming ideas?
I don't know what you mean by this. The addition of join to the Monad
class has no effect on the user of Monads, and increases possibilities for
programmers defining Monads. Does that make us mathematicians? What does
that imply? What is the cause of that?
Regards,
Koen.
--
| Koen Claessen, [EMAIL PROTECTED] |
| http://www.cse.ogi.edu/~kcclaess/ |
|------------------------------------------------------|
| Visiting student at OGI, Portland, Oregon, USA. |