ConstraintKinds and default associated empty constraints

Antoine Latter aslatter at gmail.com
Mon Jan 9 07:30:41 CET 2012


On Sun, Jan 8, 2012 at 11:21 PM, wren ng thornton <wren at freegeek.org> wrote:
>
>
> Couldn't the following work?
>
>
>    class Functor f where
>        type C f :: * -> Constraint
>        type C f _ = ()
>

I get a parse error from that.

The equivalent:

   class Functor f where
       type FC f :: * -> Constraint
       type FC f a = ()

gives the error:

    Number of parameters must match family declaration; expected 1
    In the type synonym instance default declaration for `FC'
    In the class declaration for `Functor'

> It seems to me that adding const to the type level (either implicitly or
> explicitly) is cleaner and simpler than overloading () to be Constraint,
> *->Constraint, *->*->Constraint,...
>
> --
> Live well,
> ~wren
>
>
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



More information about the Glasgow-haskell-users mailing list