[Haskell-cafe] Instances of constrained datatypes

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Wed Apr 6 02:52:39 EDT 2005


Arjun Guha <guhaarju at grinnell.edu> writes:

>  > data (Eq v) => EqList v = EqList [v]
>
> I'd like to make it an instance of Functor.  However, fmap takes an
> arbitrary function  of type a -> b.  I need an Eq constraint on a and
> b.  Is there any way to do this without creating my own `EqFunctor'
> class with explicitly-kinded quantification:

No.

Why not to remove the Eq v constraint in the type?

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak at knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/


More information about the Haskell-Cafe mailing list