[GHC] #13407: Fix printing of higher-rank kinds

GHC ghc-devs at haskell.org
Mon Jun 12 21:54:06 UTC 2017


#13407: Fix printing of higher-rank kinds
-------------------------------------+-------------------------------------
        Reporter:  goldfire          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.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 simonpj):

 Remember that teh arguments in a type instance are types, not type
 variables.  So when you write
 {{{
 type instance Foo (a :: forall k. k-> TYpe) = ...
 }}}
 GHC treats it much like
 {{{
 -- Suppose T :: forall k. k -> Type

 type instance Foo T = ...
 }}}
 It'll instantaite `T`'s kind to give `T k1` (where `k1` is a unification
 variable.  Then it'll to unify `k1->Type` with the expected argument kind
 of `F`, namely `Type`.   Hence the error mesage.

 Th eoddity is that it prints `a k1` rather than just `a` even without
 `fprint-explicit-kinds`.  I expect that's because the head isn't at type
 constructor, but rather a type variable -- a pretty-printing bug.  But a
 palpable bug, I think.

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


More information about the ghc-tickets mailing list