
#14332: Deriving clauses can have forall types -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.2.1 checker) | Resolution: | Keywords: deriving Operating System: Unknown/Multiple | Architecture: Type of failure: GHC accepts | Unknown/Multiple invalid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): Replying to [comment:14 simonpj]:
Ryan, might you be able to do this?
Er, I doubt it. This sounds like it goes well beyond my abilities as a GHC hacker, since it requires intricate knowledge of: * Somehow informing GHC of which type variables are "OK to unify" for instance, the `k` in `data Proxy (a :: k)` is OK to unify, but the `k` in `deriving (C (a :: k))` is not—what is the secret sauce in GHC to specify this? I have no idea. Actually, it's even more subtle than that. There are scenarios when you'd want to unify kind variables in `deriving` types: when they're //invisible//. For instance: {{{#!hs newtype Identity a = Identity a deriving Generic1 }}} Here, `Generic1 :: (k -> *) -> Constraint`. But note that we never write `k` explicitly, so it's more like `deriving (Generic1 {k})`. However, we ultimately unify `k` with `*` in the end, giving us `deriving (Generic1 {*})`. Somehow, we //also// have to inform GHC that this is OK. Urp... * WTF this "skolem" business from comment:9 is about. (I don't know if I could even give a proper definition of this word, let alone profitably implement it.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14332#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler