Superclass Cycle via Associated Type

Ryan Trinkle ryant5000 at gmail.com
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:


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



Ryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20110720/7734af77/attachment.htm>


More information about the Glasgow-haskell-users mailing list