Cannot have type variable named `role`
data Policy role = Policy
fails with
GHCi, version 8.10.2: https://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( Role.hs, interpreted )
Role.hs:1:13: error: parse error on input ‘role’
|
1 | data Policy role = Policy
| ^^^^
In GHC-7.6.3 (pre roles) this code is fine.
Similarly
data Policy family = Policy
Fails In GHC-7.8..GHC-8.10, but is fine with GHC-7.6.
The https://downloads.haskell.org/ghc/8.10.2/docs/html/users_guide/bugs.html#lexical-syntax mentions only forall
as extra keyword (data Policy forall = Policy
become invalid in GHC-8.8). I'd expect role
and family
to be either mentioned in lexical syntax divergence section, or made to work. Both seem to be fine as term identifiers.
EDIT: also the error messages is unhelpful. The parser error should mention that role
, (family
, forall
) are interpreted as keyword