[GHC] #11067: Spurious superclass cycle error with type equalities

GHC ghc-devs at haskell.org
Sun Nov 8 02:03:49 UTC 2015


#11067: Spurious superclass cycle error with type equalities
-------------------------------------+-------------------------------------
        Reporter:  oerjan            |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.0.1
       Component:  Compiler (Type    |              Version:  7.10.2
  checker)                           |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by oerjan):

 To prevent the `Skolem` from leaking via pattern matching, I had to change
 `Forall` to use a type class instead. I first tried

 {{{#!hs
 class p (Skolem p) => Forall (p :: k -> Constraint)
 instance p (Skolem p) => Forall (p :: k -> Constraint)
 }}}

 etc., but this made the cycle errors come back, even more widespread than
 before (`Monoid2` no longer worked). However, adding a closed type family
 in the right spot again worked to soothe GHC:

 {{{#!hs
 type family Forall (p :: k -> Constraint) where
     Forall p = Forall_ p
 class p (Skolem p) => Forall_ (p :: k -> Constraint)
 instance p (Skolem p) => Forall_ (p :: k -> Constraint)
 }}}

 This seems a bit silly :P

 (Also, the last instance above should have a `Forall_`, but the `_` is
 invisible, at least in preview...)

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11067#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list