[Haskell-cafe] Class Synonyms
sholderm at students.cs.uu.nl
Sat Dec 11 03:55:51 EST 2004
> I'd like to achieve something better than this. I was looking for
> like "class synonyms". So if I declared an instance Foo A A, I
> had Bar A, because they'd be the same.
Using -fallow-undecidable-instances (in GHC) you could do:
class Foo a b | a -> b where
foo_method1 :: ...
foo_method2 :: ...
class (Foo a a) => Bar a where
instance (Foo a a) => Bar a where -- replaces all your other Bar
instance Foo Integer Integer where
foo_method1 = ...
foo_method2 = ...
More information about the Haskell-Cafe