[Haskell-cafe] Restrictions on associated types for classes

Tom Schrijvers Tom.Schrijvers at cs.kuleuven.be
Thu Dec 17 09:22:23 EST 2009


> class MyClass k where
>  type AssociatedType k :: *
>
> Is there a way of requiring AssociatedType be of class Eq, say?

Have you tried:

{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE FlexibleContexts #-}

class Eq (AssociatedType k) => MyClass k where
   type AssociatedType k :: *

?

Cheers,

Tom

--
Tom Schrijvers

Department of Computer Science
K.U. Leuven
Celestijnenlaan 200A
B-3001 Heverlee
Belgium

tel: +32 16 327544
e-mail: tom.schrijvers at cs.kuleuven.be
url: http://www.cs.kuleuven.be/~toms/

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm


More information about the Haskell-Cafe mailing list