
#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: #14331 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * related: => #14331 Comment: It turns out that the changes in the parser necessary to accommodate `forall`s in `deriving` clauses (without the double parentheses junk) is essentially just this: {{{#!diff diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y index af8c95f..7ad3025 100644 --- a/compiler/parser/Parser.y +++ b/compiler/parser/Parser.y @@ -1979,9 +1985,9 @@ inst_type :: { LHsSigType GhcPs } : sigtype { mkLHsSigType $1 } deriv_types :: { [LHsSigType GhcPs] } - : typedoc { [mkLHsSigType $1] } + : ktypedoc { [mkLHsSigType $1] } - | typedoc ',' deriv_types {% addAnnotation (gl $1) AnnComma (gl $2) + | ktypedoc ',' deriv_types {% addAnnotation (gl $1) AnnComma (gl $2) >> return (mkLHsSigType $1 : $3) } comma_types0 :: { [LHsType GhcPs] } -- Zero or more: ty,ty,ty }}} I'm not going to open a Diff for this now, since it would be nice to combine the fix for this ticket with that of #14331. But I'll record this here for posterity's sake. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14332#comment:18 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler