Duplicate role annotations [GHC-97170]
This error occurs if more than one role annotation occurs for a given datatype. Note that the role annotations need not be conflicting for this error to arise. Also note that the role annotations can occur in different locations from the datatype.
Examples
Double role annotation on datatype
Error Message
DoubleRoleAnnotationOnData.hs:6:1: error: [GHC-97170]
Duplicate role annotations for ‘Foo’:
type role Foo nominal
-- written at DoubleRoleAnnotationOnData.hs:5:1-21
type role Foo representational
-- written at DoubleRoleAnnotationOnData.hs:6:1-30
|
6 | type role Foo representational
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
DoubleRoleAnnotationOnData.hs
Before
{-# LANGUAGE RoleAnnotations #-}
module DoubleRoleAnnotationOnData where
data Foo a = MkFoo a
type role Foo nominal
type role Foo representational
After
{-# LANGUAGE RoleAnnotations #-}
module DoubleRoleAnnotationOnData where
data Foo a = MkFoo a
type role Foo nominal