[Haskell-cafe] Restrictions on associated types for classes

Roman Leshchinskiy rl at cse.unsw.edu.au
Thu Dec 17 09:36:07 EST 2009


On 18/12/2009, at 00:37, Stephen Lavelle wrote:

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

This works with -XFlexibleContexts:

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


Roman




More information about the Haskell-Cafe mailing list