[Haskell-cafe] Restrictions on associated types for classes

Stephen Lavelle analytic at gmail.com
Thu Dec 17 13:04:08 EST 2009


Ah yes, this is very very very helpful.  Thanks : )

Miguel's example is not quite as idiomatic, but...for some reason I
find it beguiling nonetheless.

On Thu, Dec 17, 2009 at 2:36 PM, Roman Leshchinskiy <rl at cse.unsw.edu.au> wrote:
> 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