[GHC] #11519: Inferring non-tau kinds

GHC ghc-devs at haskell.org
Mon Feb 8 09:05:55 UTC 2016


#11519: Inferring non-tau kinds
-------------------------------------+-------------------------------------
        Reporter:  goldfire          |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.1
      Resolution:                    |             Keywords:  TypeInType
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:"2cf3cac6a05879c27fa82b12dd34cce39a262402/ghc"
 2cf3cac6/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="2cf3cac6a05879c27fa82b12dd34cce39a262402"
 Allow foralls in instance decls

 This patch finally makes it possible to have explicit
 foralls in an instance decl
    instance forall (a :: *). Eq a => Eq [a] where ...

 This is useful to allow kind signatures or indeed
 explicicit kind for-alls; see Trac #11519

 I thought it would be really easy, because an instance
 declaration already contains an actual HsSigType, so all
 the syntactic baggage is there.  But in fact it turned
 out that instance declarations were kind-checked a
 little differently, because the body kind of the forall
 is 'Constraint' rather than '*'.

 So I fixed that.  There a slight kludge
 (see Note [Body kind of a HsQualTy], but it's still a
 significant improvement.

 I also did the usual other round of refactoring,
 improved a few error messages, tidied up comments etc.
 The only significant aspect of all that was

   * Kill mkNakedSpecSigmaTy, mkNakedPhiTy, mkNakedFunTy
     These function names suggest that they do something
     complicated, but acutally they do nothing. So I
     killed them.

   * Swap the arg order of mkNamedBinder, just so that it is
     convenient to say 'map (mkNamedBinder Invisible) tvs'

   * I had to improve isPredTy, to deal with (illegal)
     types like
        (Eq a => Eq [a]) => blah
     See Note [isPeredTy complications] in Type.hs

 Still to come: user manual documentation for the
 instance-decl change.
 }}}

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


More information about the ghc-tickets mailing list