[GHC] #11523: Infinite Loop when mixing UndecidableSuperClasses and the class/instance constraint synonym trick.

GHC ghc-devs at haskell.org
Wed Mar 16 17:18:57 UTC 2016


#11523: Infinite Loop when mixing UndecidableSuperClasses and the class/instance
constraint synonym trick.
-------------------------------------+-------------------------------------
        Reporter:  ekmett            |                Owner:
            Type:  bug               |               Status:  new
        Priority:  highest           |            Milestone:  8.0.1
       Component:  Compiler (Type    |              Version:  8.0.1-rc1
  checker)                           |             Keywords:
      Resolution:                    |  UndecidableSuperClasses
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  GHC rejects       |            Test Case:
  valid program                      |  polykinds/T11523
      Blocked By:                    |             Blocking:
 Related Tickets:  #11480            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 The undecideable superclasses thing has the following property:

 * If you have a type error (a wanted that genuinely cannot be solved)
 * and you have an infinite number of superclasses

 then the typechecker will diverge, or at least complain about too many
 iterations.

 In this case, do you think that there is a finite tower of superclasses?
 I get
 {{{
 [G] Category p
 +-> {add superclasses}
         Functor p
         Dom p ~ Op p
         Cod p ~ Nat p (->)
         Ob (Op p) ~ Ob p

 +-> {add superclasse of Functor}
         Category (Dom p)
         Cateogory (Cod p)
 }}}
 and now we merrily go round.  Adding `p ~ Op (Op p)` will help, because
 `Dom p ~ Op p`.  But we are still going to get `Cateogry (Cod p)`,
 `Category (Cod (Cod p))` and so on.  Is that really what you intend?

 Actually we get a hand without "too many iterations", which is odd, but
 still I'd like to know the answer to the above.

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


More information about the ghc-tickets mailing list