Skip to content

Type roles in GHCi

This works:

λ> data A a; type role A nominal
λ> :i A
type role A nominal
data A a

This doesn't:

λ> data A a
λ> type role A nominal
λ> :i A
type role A phantom
data A a

Accepting role annotations after the definition probably leads to problems when intermediate definitions relied on the earlier role; so I think the second situation should give an error. In fact, in the second snippet GHC does not even require -XRoleAnnotations.

Trac metadata
Trac field Value
Version 7.7
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC goldfire
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information