
Hello, The last 3 or 4 days I have been studying a lot of Category Theory so that I would be able to explain the concept of a monad to some people at the university in a "learn to present something"-course. newtype S a = State -> (a,State) -- functor T to map objects mapS::(a-> b) -> (S a -> S b) -- functor T to map morphisms unitS :: a -> S a --\eta joinS::S(S a)-> S a -- \mu This is a complete monad using a direct mapping from Category Theory. I really like it, because it's mathematically grounded. But I don't know how to map this to Haskell monads using the standard "bind" and "return", as I explain below. Although, I do believe I understand most parts of it(as in Functor, Natural Transformation and so on), I don't really understand how the join function (conventional monadic multiplication as it's called in the documentation) relates to the >>= and return functions that are mostly used. I read somewhere at Google that join can be expresed in terms of >>= and return, but I couldn't find it anymore. I also read that the Kleisli triple has more resemblance to how monads are used in practice, but it has some additional constraints. I don't understand why there are these additional constraints and I don't understand it's relevance, because according to some book there's a one-one mapping from monads to Kleisli triples and reverse. I also don't understand why join is a "multiplication", because a multiplication takes two operands (as in 5*4), at least all multiplication operators I know do so. I think what's happening is that one structure is taken out of the other. And then, the two are "merged" in some way. So this way, there are two operands. Is this correct? (I really could use a function definition in Haskell of join in terms of bind and return). Can somebody explain me (with a lot of detail) how this works? Regards, Ron __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com