[Haskell-cafe] type classes

Ketil Malde ketil+haskell at ii.uib.no
Fri Dec 14 09:01:39 EST 2007


Lutz Donnerhacke <lutz at iks-jena.de> writes:

> * Peter Padawitz wrote:
>> I'd like to define several instances of the same type class with the
>> same type variable instance. Only method instances differ. How can I do
>> this without writing copies of the type class?

> Define the type class in a module named "MyClass". Define the each instance
> in a module named "MyInstanceX" where X is a version number.

> Include only the "MyInstanceX" module, you currently need.

Or, if you need more than one at the same time, wrap your data type in
one newtype per instance.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants


More information about the Haskell-Cafe mailing list