Superclass Cycle via Associated Type

Ryan Trinkle ryant5000 at
Wed Jul 20 18:37:27 CEST 2011

The following code doesn't compile, but it seems sensible enough to me.  Is
this a limitation of GHC or is there something I'm missing?

class C (A x) => C x where
  type A x :: *
instance C Int where
  type A Int = String
instance C String where
  type A String = Int

The error I get is:

    Cycle in class declarations (via superclasses):
      SuperclassCycle.hs:(1,1)-(2,15): class C (A x) => C x where {
                                           type family A x :: *; }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Glasgow-haskell-users mailing list