
#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): Ah! I disagee with comment:20. Let's start with this, after renaming: {{{ class C a b data D c = D deriving (forall k. C (c :: k)) }}} Now we typecheck the class and `data D` decls, but not yet the `deriving` part, yielding {{{ class C {k1} {k2} (a:k1) (b:k2) data D {k3} (c:k3) = D deriving (forall k. C (c :: k)) }}} Now we move on to typechecking the `deriving` clause. Here we fail, becuase `c` has kind `k3` but its occurrence in the deriving clause claims it has kind `k`, where those two binders are quite different. And that's just what the error message says. To make it work, write {{{ data D (c::k) = D deriving( D c ) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14331#comment:26 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler