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

Ben Franksen ben.franksen at online.de
Thu Nov 29 03:52:58 CET 2012

Tony Morris wrote:
> As a side note, I think a direct superclass of Functor for Monad is not
> a good idea, just sayin'
> class Functor f where
>   fmap :: (a -> b) -> f a -> f b
> class Functor f => Apply f where
>   (<*>) :: f (a -> b) -> f a -> f b
> class Apply f => Bind f where
>   (=<<) :: (a -> f b) -> f a -> f b
> class Apply f => Applicative f where
>   unit :: a -> f a
> class (Applicative f, Bind f) => Monad f where
> Same goes for Comonad (e.g. [] has (=<<) but not counit)
> ... and again for Monoid, Category, I could go on...

Hi Tony

even though I dismissed your mentioning this on the Haskell' list, I do have 
to admit that the proposal has a certain elegance. However, before I buy 
into this scheme, I'd like to see some striking examples for types with 
natural (or at least useful) Apply and Bind instances that cannot be made 
Applicative resp. Monad. Also, it is not clear to me what laws should hold 
for them.

Ben Franksen
()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments

More information about the Haskell-Cafe mailing list