[Haskell-cafe] Retrospective type-class extension
Limestraël
limestrael at gmail.com
Thu May 20 07:45:44 EDT 2010
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 at gmail.com>
> Ivan Miljenovic wrote:
> > On 20 May 2010 14:42, Tony Morris <tonymorris at 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 at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100520/176547c0/attachment.html
More information about the Haskell-Cafe
mailing list