File tree Expand file tree Collapse file tree 6 files changed +157
-0
lines changed
Expand file tree Collapse file tree 6 files changed +157
-0
lines changed Original file line number Diff line number Diff line change 1+ # ` DuplicateRoleDeclaration ` Error
2+
3+ ## Example
4+
5+ ``` purescript
6+ module ShortFailingExample where
7+
8+ data D a = D a
9+ type role D nominal
10+ type role D nominal
11+ ```
12+
13+ ## Cause
14+
15+ Multiple role declarations are provided for the same type.
16+
17+ ## Fix
18+
19+ - Remove the extraneous role declarations:
20+
21+ ``` diff
22+ data D a = D a
23+ type role D nominal
24+ - type role D nominal
25+ ```
Original file line number Diff line number Diff line change 1+ # ` InvalidCoercibleInstanceDeclaration ` Error
2+
3+ ## Example
4+
5+ ``` purescript
6+ module ShortFailingExample where
7+
8+ import Prim.Coerce (class Coercible)
9+
10+ instance coercible :: Coercible a b
11+ ```
12+
13+ ## Cause
14+
15+ ` Coercible ` instances are solved by the compiler and cannot be declared.
16+
17+ ## Fix
18+
19+ - Remove the instance declaration.
Original file line number Diff line number Diff line change 1+ # ` OrphanRoleDeclaration ` Error
2+
3+ ## Example
4+
5+ ``` purescript
6+ module ShortFailingExample where
7+
8+ type role D nominal
9+ ```
10+
11+ ## Cause
12+
13+ A role declaration is provided but does not immediately follow it's declaration.
14+
15+ ## Fix
16+
17+ - Check that you've provided the appropriate ` data ` or ` newtype ` declaration.
Original file line number Diff line number Diff line change 1+ # ` RoleDeclarationArityMismatch ` Error
2+
3+ ## Example
4+
5+ ``` purescript
6+ module ShortFailingExample where
7+
8+ data D a = D a
9+ type role D nominal nominal
10+ ```
11+
12+ ## Cause
13+
14+ The arity of a role declaration does not match the arity of its corresponding type.
15+
16+ ## Fix
17+
18+ - Remove the extraneous roles:
19+
20+ ``` diff
21+ data D a = D a
22+ - type role D nominal nominal
23+ + type role D nominal
24+ ```
Original file line number Diff line number Diff line change 1+ # ` RoleMismatch ` Error
2+
3+ ## Example
4+
5+ ``` purescript
6+ module ShortFailingExample where
7+
8+ data D a = D a
9+ type role D phantom
10+ ```
11+
12+ ``` purescript
13+ module ShortFailingExample where
14+
15+ data D f a = D (f a)
16+ type role D representational representational
17+ ```
18+
19+ ## Cause
20+
21+ A parameter was assigned a role more permissive than required.
22+
23+ ## Fix
24+
25+ - Remove or strengthen the role declaration:
26+
27+ ``` diff
28+ data D a = D a
29+ - type role D phantom
30+ + type role D representational
31+ ```
32+
33+ ``` diff
34+ data D f a = D (f a)
35+ - type role D representational representational
36+ + type role D representational nominal
37+ ```
Original file line number Diff line number Diff line change 1+ # ` UnsupportedRoleDeclaration ` Error
2+
3+ ## Example
4+
5+ ``` purescript
6+ module ShortFailingExample where
7+
8+ class C a
9+ type role C representational
10+ ```
11+
12+ ``` purescript
13+ module ShortFailingExample where
14+
15+ data D a = D a
16+
17+ type S a = D a
18+ type role S nominal
19+ ```
20+
21+ ## Cause
22+
23+ A role declaration is provided for a type synonym or a type class.
24+
25+ ## Fix
26+
27+ - Remove the role declaration or provide a role declaration for the underlying type of the synonym instead:
28+
29+ ``` diff
30+ data D a = D a
31+ + type role D nominal
32+
33+ type S a = D a
34+ - type role S nominal
35+ ```
You can’t perform that action at this time.
0 commit comments