Naive instantiation

Dusan Kolar kolar at
Tue Oct 7 15:34:08 EDT 2003


  I've got (maybe a bit naive) question, whether it is possible
to have instance of class (already derived from another class)
if it uses more concrete type than instances of predecesing classes.
Let us assume the following example:

  class A a where...
  class (A a) => B a where...
  class (B a) => C a where...

  data MyData a = MD Int a

  instance A (MyData a) where...
  instance B (MyData a) where...
  instance C (MyData Int) where...

Hugs/GHCi produce errors, of course. Nevertheless, is there
any way to obtain such a feature? (In this example, classes
A and B represent "abstract" classes providing functions with
general algorithms, while class C cannot have a general implementation
and requires a concrete data type for MyData.)

  Thank you for any hints,


More information about the Haskell-Cafe mailing list