[Haskell-cafe] Why Kleisli composition is not in the Monad signature?

Ertugrul Söylemez es at ertes.de
Mon Oct 15 13:59:47 CEST 2012

damodar kulkarni <kdamodar2000 at gmail.com> wrote:

> The Monad class makes us define bind (>>=) and unit (return) for our
> monads.
> Why the Kleisli composition (>=>) or (<=<) is not made a part of Monad
> class instead of bind (>>=)?
> Is there any historical reason behind this?
> The bind (>>=) is not as elegant as (>=>), at least as I find it.
> Am I missing something?

Try to express

    do x <- getLine
       y <- getLine
       print (x, y)

using only Kleisli composition (without cheating).  Through cheating
(doing non-categorical stuff) it's possible to implement (>>=) in terms
of (<=<), but as said that's basically breaking the abstraction.


Not to be or to be and (not to be or to be and (not to be or to be and
(not to be or to be and ... that is the list monad.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121015/0a7090a4/attachment.pgp>

More information about the Haskell-Cafe mailing list