-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentation for GHC-06202 (TcRnMisplacedInstSig)
- Loading branch information
1 parent
230bfed
commit 91ddc73
Showing
4 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{-# LANGUAGE Haskell2010, InstanceSigs #-} | ||
module Example1 where | ||
|
||
data A = A | B | ||
instance Eq A where | ||
(==) :: A -> A -> Bool | ||
A == A = True | ||
B == B = True | ||
_ == _ = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{-# LANGUAGE Haskell2010 #-} | ||
module Example1 where | ||
|
||
data A = A | B | ||
instance Eq A where | ||
(==) :: A -> A -> Bool | ||
A == A = True | ||
B == B = True | ||
_ == _ = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
title: Illegal type signature in instance declaration | ||
--- | ||
|
||
## Error message | ||
|
||
Type signatures are only allowed to be in instance declarations when the `InstanceSigs` language extension is enabled. | ||
|
||
``` | ||
Example1.hs:6:13: error: [GHC-06202] | ||
• Illegal type signature in instance declaration: | ||
(==) :: A -> A -> Bool | ||
• In the instance declaration for ‘Eq A’ | ||
Suggested fix: Perhaps you intended to use InstanceSigs | ||
| | ||
6 | (==) :: A -> A -> Bool | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
title: Illegal type signature in instance declaration | ||
summary: Method in class instance has type signature, but extension InstanceSigs is not enabled | ||
severity: error | ||
introduced: 9.6.1 | ||
--- | ||
|
||
This error is emitted when class instance has type signature, but extension [InstanceSigs](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/instances.html#instance-signatures-type-signatures-in-instance-declarations) is not enabled. Note that `InstanceSigs` is part of `GHC2021` and `GHC2024` [editions](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/control.html), so you won't encounter this error in new code unless you explicitely opt-out. |