#2497: Weird scoping for tyvars in rules
----------------------+-----------------------------------------------------
Reporter: rl | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.8.3
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Architecture: Unknown
Os: Unknown |
----------------------+-----------------------------------------------------
Comment (by rl):
My two pebbles...
* '''ACTION 1''': Agreed in principle, but what about backwards
compatibility? There is a lot of code with RULES and none of it uses
`-XRewriteRules`. IMO, it would be better to always recognise RULES. Note
also that RULES don't necessarily require `forall`; see
http://www.haskell.org/ghc/docs/latest/html/users_guide/rewrite-rules.html
#rule-spec for examples.
* '''ACTION 2''': I think `forall` in RULES should always be recognised
as a keyword. It is quite different from the other uses of `forall`,
anyway, since it quantifies over terms, not types. Also, coupling
`explicitForallBit` with a not obviously related language feature seems
wrong. If `forall` isn't always recognised in RULES, we should have a
separate `-XForallKeyword` (perhaps we should have that anyway).
* '''ACTION 3''': I think the two should be kept separate but don't
really care either way.
* '''ACTION 4''': Enable `-XScopedTypeVariables` locally. Does
`-XPatternSignatures` apply to RULES somehow? If so, enable this locally
as well.
* '''ACTION 5''': `-fuse-rewrite-rules` or `-fapply...` looks good to me.
* I think `forall` in RULES should bind type variables as well. I'm not
sure new syntax is needed here: if it is used as a type, it's a type
variable, otherwise it's a term variable. Or can this lead to ambiguities?
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2497#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs