[GHC] #14332: Deriving clauses can have forall types
GHC
ghc-devs at haskell.org
Thu Oct 12 07:53:30 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 simonpj):
OK, so to review:
* We need to write up
[https://ghc.haskell.org/trac/ghc/ticket/14331#comment:8 the
rationalisation] in the user manual.
* If we are going to make it a proper feature (which it already is), we
should not require silly parens. E.g. this example from the Description
{{{
data D a = D deriving ((forall a. C a))
}}}
works just as we intend, but should not require the second pair of
parens -- a parser bug.
* The second example from the Description is also OK
{{{
data Proxy (a :: k) = Proxy
deriving ((forall k2. (Generic1 :: (k2 -> Type) -> Constraint)))
}}}
As I put it in the rationalisation, `k` comes from the data type decl,
and `k2` from the instance; but it's fine to instantiate `k` to `k2` in
that instance decl. And that is just what happens. Worth an example in
the user manual perhaps, after the one about `Functor Proxy`.
Ryan, might you be able to do this?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14332#comment:14>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list