Skip to content

Role annotation should never be ambiguous

[ezyang@hs01 ghc-backpack]$ cat A.hs
{-# LANGUAGE RoleAnnotations #-}
module A where
data Maybe a = AF
type role Maybe representational
[ezyang@hs01 ghc-backpack]$ ghc -c A.hs

A.hs:4:11:
    Ambiguous occurrence ‘Maybe’
    It could refer to either ‘A.Maybe’, defined at A.hs:3:1
                          or ‘Prelude.Maybe’,
                             imported from ‘Prelude’ at A.hs:2:8
                             (and originally defined in ‘GHC.Base’)

This is silly because roles can only ever be defined with the declaration, so only one reference makes sense.

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