
Ertugrul Söylemez wrote:
damodar kulkarni
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.
What do you mean with "cheating" / "doing non-categorical stuff"? m >>= f = (const m >=> f) () f >=> g = \x -> f x >>= g How does the first definition "break the abstraction" while the second does not? Cheers -- Ben Franksen () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments