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

GHC ghc-devs at haskell.org
Sat Oct 14 21:33:48 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):

 Re comment:17, consider
 {{{
 data Foo a = Foo (Proxy (a :: k))
 data D a = D deriving (C (a :: k))
 }}}
 You suggest that these are similar, but they aren't. After renaming we
 have
 {{{
 data Foo {k} a = Foo (Proxy (a :: k))
 data D a = D deriving (forall {k}. C (a :: k))
 }}}
 Notice the different scoping of the two `k`'s.  So the two really aren't
 the same at all.

 We ''could'' have specified different quantifaction semantics for `Foo`
 thus
 {{{
 data Foo a = Foo (forall {k}. Proxy (a :: k))
 }}}
 But we didn't, and for good reasons.

 Likewise the tighter scoping in the deriving clause has a good
 justification.

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


More information about the ghc-tickets mailing list