Type synonyms can make roles too conservative
import GHC.Exts
type Arr# = Array#
data Foo a = Foo (Arr# a)
type role Foo representational
produces
error:
• Role mismatch on variable a:
Annotation says representational but role nominal is required
• while checking a role annotation for ‘Foo’
If the type synonym is instead defined
type Arr# a = Array# a
then it works fine.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.2.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Type checker) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |