[GHC] #15412: "Instance head is not headed by a class" when `Constraint` replaced with `type C = Constraint`

GHC ghc-devs at haskell.org
Wed Jul 25 11:25:48 UTC 2018


#15412: "Instance head is not headed by a class" when `Constraint` replaced with
`type C = Constraint`
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.4.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

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

 In [changeset:"c5d31df70b16dc346b5860077c8bbe585ddb7a78/ghc"
 c5d31df7/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="c5d31df70b16dc346b5860077c8bbe585ddb7a78"
 Treat isConstraintKind more consistently

 It turned out that we were not being consistent
 about our use of isConstraintKind.

 It's delicate, because the typechecker treats Constraint and Type as
 /distinct/, whereas they are the /same/ in the rest of the compiler
 (Trac #11715).

 And had it wrong, which led to Trac #15412.  This patch does the
 following:

 * Rename isConstraintKind      to tcIsConstraintKind
          returnsConstraintKind to tcReturnsConstraintKind
   to emphasise that they use the 'tcView' view of types.

 * Move these functions, and some related ones (tcIsLiftedTypeKind),
   from Kind.hs, to group together in Type.hs, alongside isPredTy.

 It feels very unsatisfactory that these 'tcX' functions live in Type,
 but it happens because isPredTy is called later in the compiler
 too.  But it's a consequence of the 'Constraint vs Type' dilemma.
 }}}

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


More information about the ghc-tickets mailing list