Functor instance for Set?

Bas van Dijk v.dijk.bas at gmail.com
Thu Mar 1 17:33:16 CET 2012


On 1 March 2012 13:20, Twan van Laarhoven <twanvl at gmail.com> wrote:
> On 01/03/12 09:31, Bas van Dijk wrote:
>>
>> class Functor f where
>>     type FunctorConstraint f :: * ->  Constraint
>>     type FunctorConstraint f = Empty
>>
>>     fmap :: (FunctorConstraint f b) =>  (a ->  b) ->  f a ->  f b
>>
>> class Empty a
>> instance Empty a
>
>
> Do you really need this Empty class? That seems inconvenient. I had hoped
> you would be able to write something like
>
>
>    type FunctorConstraint f :: * ->  Constraint
>    type FunctorConstraint f a = ()
>
>
> Twan
>
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries

In GHC-7.4.1 that will give the following error:

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

However, I believe SPJ fixed this in HEAD.

Bas



More information about the Libraries mailing list