
11 Dec
2004
11 Dec
'04
3:55 a.m.
Jorge,
I'd like to achieve something better than this. I was looking for something like "class synonyms". So if I declared an instance Foo A A, I automagicaly had Bar A, because they'd be the same.
Using -fallow-undecidable-instances (in GHC) you could do: \begin{code} 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 instances instance Foo Integer Integer where foo_method1 = ... foo_method2 = ... \end{code} HTH, Stefan