[Haskell-cafe] Restricted type classes

John Lato jwlato at gmail.com
Tue Sep 7 05:32:10 EDT 2010


2010/9/7 Ivan Lazar Miljenovic <ivan.miljenovic at gmail.com>

> 2010/9/7 Gábor Lehel <illissius at gmail.com>:
> > *That said*, I actually have nothing at all against splitting the 'a
> > -> f a' method out into a separate class if you think it's useful,
> > whether you call it Pointed or something else. (And `class (Pointed f,
> > Functor f) => PointedFunctor f` is sort of cute.)
>
> It might be cute, but until we get class aliases [1] this results in
> yet another class to make your data type an instance of, and what's
> more it's one that doesnt' even give you anything.
>
> I think it makes much more sense to have Functor, Pointed and
> "(Functor f, Pointed f) => Applicative f" rather than a useless
> intermediary class.  If, however, we could get class aliases _for
> free_ (i.e. something like "class alias PointedFunctor f = (Functor f,
> Pointed f)" for which all instances of Functor and Pointed are
> automatically instanced of PointedFunctor), then I can see that as
> being something nice to have.
>

I agree completely.

John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100907/32c5ea15/attachment.html


More information about the Haskell-Cafe mailing list