[GHC] #14332: Deriving clauses can have forall types
GHC
ghc-devs at haskell.org
Mon Oct 9 02:38:44 UTC 2017
#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):
OK, that's a start. But I have more questions:
* Are the `forall`'d type variables in a `deriving` clause's type assumed
to be distinct from the type variables bound by a data type itself? If so,
how should GHC treat derived instances that would only work if kind
unification were to occur? For instance, `data Proxy (a :: k) = Proxy
deriving (Generic1 :: (k -> Type) -> Constraint)` is clearly OK, but `data
Proxy (a :: k) = Proxy deriving (forall k. Generic1 :: (k -> Type) ->
Constraint)` isn't, since it can't unify the `k` from the derived type and
the `k` from the datatype. What should GHC do here?
* What happens if one of the variables isn't quantified over (e.g., `data
D = D deriving (forall a. C a b)`)? Is this an error?
Many I'd be convinced if I did see a full write-up of this in a proposal.
But as it stands, I'm quite unconvinced that this would work out if you
actually sat down and attempted to implement this.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14332#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list