
--- "Iavor S. Diatchki"
hi ron,
here are the relations between the two formulations of monads: (using haskell notation)
map f m = m >>= (return . f) join m = m >>= id
m >>= f = join (fmap f m)
there are quite a few general concepts that you need to understand in what sense monads are monoids, but to understand how monads work you don't need to know that.
Ron de Bruijn wrote:
I am pretty sure, that >>= is to monads what * is to for example natural numbers, but I don't know what the inverse of >>= is. And I can't really find it anywhere on the web(papers, websites, not a single sole does mention it.
this is not quie correct. (join & return) for a monad are like (*,1) or (+,0) for the set of integers. however those operations on integers have more structure than join and return.
there is no operation for "inverse". in mathematical terms: monads are a monoid (given that the notion is generalized considerably from its usual use), and not a group. if one was to add such an operation (i am not sure what it would do), but it would be of type: inverse :: M a -> M a (and of course must satisfy some laws)
also while you are pondering these things, it may be useful to use the "backward join" (=<<) :: (a -> m b) -> (m a -> m b). the reason for that is that strictly speaking tha arrow in the middle is different from the left and the right arrows
i am not sure how useful this information is for you, but if you have more questions ask away -iavor I found out what a group is: A group is a monoid each of whose elements is invertible.
Only I still find it weird that join is called a multiplication, because according to the definition of multiplication, there should be an inverse. I think, thus that multiplication is only defined on a group. And now still remains: why do they call it a multiplication, while by definition it's not. Or should I understand it as: there's a concept called multiplication and for different structures there's a definition? I think, now I think over it, that it would seem logical. It could be possible that the definition is incorrect, though. Does anyone knows of a definition that is more general (and not absolute nonsens ;))? The information you give me is *very* usefull, because I don't just want to work with monads, I truly want to understand them. Ron __________________________________ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/