Skip to content

Commit 5bb2f29

Browse files
kosmikusBinderDavid
authored andcommitted
Add explanation for GHC-97170.
1 parent c085855 commit 5bb2f29

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{-# LANGUAGE RoleAnnotations #-}
2+
module DoubleRoleAnnotationOnData where
3+
4+
data Foo a = MkFoo a
5+
type role Foo nominal
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{-# LANGUAGE RoleAnnotations #-}
2+
module DoubleRoleAnnotationOnData where
3+
4+
data Foo a = MkFoo a
5+
type role Foo nominal
6+
type role Foo representational
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: Double role annotation on datatype
3+
---
4+
5+
## Error Message
6+
7+
```
8+
DoubleRoleAnnotationOnData.hs:6:1: error: [GHC-97170]
9+
Duplicate role annotations for ‘Foo’:
10+
type role Foo nominal
11+
-- written at DoubleRoleAnnotationOnData.hs:5:1-21
12+
type role Foo representational
13+
-- written at DoubleRoleAnnotationOnData.hs:6:1-30
14+
|
15+
6 | type role Foo representational
16+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17+
```
18+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: Duplicate role annotations
3+
summary: A type declaration has more than one accompanying role annotation
4+
severity: error
5+
introduced: 9.8.1
6+
---
7+
8+
This error occurs if more than one role annotation occurs for a given datatype.
9+
Note that the role annotations need not be conflicting for this error to arise.
10+
Also note that the role annotations can occur in different locations from the
11+
datatype.

0 commit comments

Comments
 (0)