Then it would be:

class Functor f where
    fmap :: (a -> b) -> f a -> f b

class (Functor f) => Pointed f where
    pure :: a -> f a

class (Pointed f) => Applicative f where
    (<*>) :: f (a -> b) -> f a -> f b

class (Applicative f) => Monad f where
    join :: f (f a) -> f a

This would be a great idea, for the sake of logic, first (a monad which is not a functor doesn't make sense), and also to eliminate redudancy (fmap = liftM, ap = (<*>), etc.)

2010/5/20 Tony Morris <tonymorris@gmail.com>
Ivan Miljenovic wrote:
> On 20 May 2010 14:42, Tony Morris <tonymorris@gmail.com> wrote:
>
>> We all know that "class (Functor f) => Monad f" is preferable but its
>> absence is a historical mistake. We've all probably tried once:
>>
>> instance (Functor f) => Monad f where
>>
>
> Do you mean the reverse of this (instance (Monad m) => Functor m where) ?
>
Yes.

--
Tony Morris
http://tmorris.net/


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe