[GHC] #14331: Overzealous free-floating kind check causes deriving clause to be rejected

GHC ghc-devs at haskell.org
Fri Oct 13 11:31:46 UTC 2017


#14331: Overzealous free-floating kind check causes deriving clause to be rejected
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  merge
        Priority:  normal            |            Milestone:  8.2.2
       Component:  Compiler (Type    |              Version:  8.2.1
  checker)                           |
      Resolution:                    |             Keywords:  deriving
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  GHC rejects       |            Test Case:
  valid program                      |  deriving/should_compile/T14331
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 I agree.  After elaboration we expect
 {{{
 class C {k1 k2} (p::k1) (q::k2)
 data D {k3} (r::k3) = D

 instance forall {k2} k (a:k) (b:k2). C a (D {k2} b) where ...
 }}}
 So we instantiate the `k3` belonging to the data declaration to `k2`
 belonging to the instance.  The `forall k` in the `deriving` clause is
 just the kind on `a`, the first parameter for `C`.

 Right?

 Why this doesn't work I don't know.

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


More information about the ghc-tickets mailing list