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

GHC ghc-devs at haskell.org
Tue Dec 15 14:33:34 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):  Phab:D1594
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Simon Peyton Jones <simonpj@…>):

 In [changeset:"6eabb6ddb7c53784792ee26b1e0657bde7eee7fb/ghc" 6eabb6d/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="6eabb6ddb7c53784792ee26b1e0657bde7eee7fb"
 Allow recursive (undecidable) superclasses

 This patch fulfils the request in Trac #11067, #10318, and #10592,
 by lifting the conservative restrictions on superclass constraints.

 These restrictions are there (and have been since Haskell was born) to
 ensure that the transitive superclasses of a class constraint is a finite
 set.  However (a) this restriction is conservative, and can be annoying
 when there really is no recursion, and (b) sometimes genuinely recursive
 superclasses are useful (see the tickets).

 Dimitrios and I worked out that there is actually a relatively simple way
 to do the job. It’s described in some detail in

    Note [The superclass story] in TcCanonical
    Note [Expanding superclasses] in TcType

 In brief, the idea is to expand superclasses only finitely, but to
 iterate (using a loop that already existed) if there are more
 superclasses to explore.

 Other small things

 - I improved grouping of error messages a bit in TcErrors

 - I re-centred the haddock.compiler test, which was at 9.8%
   above the norm, and which this patch pushed slightly over
 }}}

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


More information about the ghc-tickets mailing list