[Haskell] Swapping parameters and type classes

Mads Lindstrøm mads_lindstroem at yahoo.dk
Sun Sep 16 10:52:00 EDT 2007

Hi all

If I have this type:

  data Foo a b = ...

and this class

  class Bar (x :: * -> *) where ...

I can imagine two ways to make Foo an instance of Bar. Either I must
"apply" the 'a' or the 'b' in (Foo a b). Otherwise it will not have the
right kind. To "apply" the 'a' I can do:

  instance Bar (Foo a) where ...

But what if I want to "apply" the 'b' ? How do I do that ?


Mads Lindstrøm

More information about the Haskell mailing list