[GHC] #13788: TypeInType fails to compile old code

GHC ghc-devs at haskell.org
Mon Jun 5 14:19:31 UTC 2017


#13788: TypeInType fails to compile old code
-------------------------------------+-------------------------------------
        Reporter:  br1               |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1-rc2
      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):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by goldfire):

 This looks like correct behavior to me. With `-XTypeInType`, GHC will
 generalize kinds, including the kind of `HEq` (now `forall k. k ->
 Constraint`) and of `Field` (now `forall k. k -> Type -> Type`). However,
 `label` can't be generalized; it has type `forall (l :: Type) (v :: Type).
 Field @Type l v -> l`. (I'm using `@` to denote a normally-elided
 parameter.)

 Because the instance at the end doesn't constraint the kind of `l`, the
 type of `f` is `Field @k l v`, where `k` is implicitly bound in the
 instance declaration. Accordingly, it can't be passed to `label`.

 The solution: add a kind signature: `instance HEq l => HListGet (Field (l
 :: Type) v) where ...`. (You will have to import `Type` from `Data.Kind`.)

 Please close the ticket if you agree with my analysis. Thanks!

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


More information about the ghc-tickets mailing list