Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions message-index/messages/GHC-06202/example1/after/Example1.hs
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
9 changes: 9 additions & 0 deletions message-index/messages/GHC-06202/example1/before/Example1.hs
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
17 changes: 17 additions & 0 deletions message-index/messages/GHC-06202/example1/index.md
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
```
8 changes: 8 additions & 0 deletions message-index/messages/GHC-06202/index.md
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.
Loading