Change role annotation syntax
Currently, role annotations look like this:
data Foo a@N = ...
I've received several criticisms of this syntax:
- It is not backward compatible. If a library wishes to use role annotations and remain compilable with earlier versions of GHC, preprocessor commands are necessary.
- It is inscrutable for someone not well-versed in roles.
- It reminds people of as-patterns, which it is unrelated to.
- It is conceivable that it would conflict with type-level as-patterns.
For these reasons, I propose the following:
data Foo a {-# ROLE Nominal #-} = ...
This syntax, while verbose, eliminates these concerns, considering that the new syntax is easily searchable for someone who doesn't know it. I have proposed something similar on ghc-devs, with no response, so I will implement it shortly.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.7 |
| Type | FeatureRequest |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |