Skip to content

Commit eebfccd

Browse files
authored
Merge pull request #441 from blamario/error-39999-superclass
Added another example of error GHC-39999
2 parents d6ba966 + 129ac54 commit eebfccd

File tree

6 files changed

+44
-1
lines changed

6 files changed

+44
-1
lines changed

message-index/messages/GHC-39999/no-instance/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: A usage of (==) on a data type which doesn‘t have an instance for Eq.
3+
order: 0
34
---
45

56
## Error message

message-index/messages/GHC-39999/overloaded-record-dot-selector-not-in-scope/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
title: A usage of `x.foo` with the field `foo` not being in scape
2+
title: A usage of `x.foo` with the field `foo` not being in scope
3+
order: 2
34
---
45

56
## Error message
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import Data.Functor.Classes (Show1(..))
2+
3+
newtype Foo a = Foo a
4+
5+
instance Show a => Show (Foo a) where
6+
show (Foo a) = "Foo " ++ show a
7+
8+
instance Show1 Foo where
9+
liftShowsPrec showsPrec _showList prec (Foo a) rest = "Foo " ++ showsPrec prec a rest
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import Data.Functor.Classes (Show1(..))
2+
3+
newtype Foo a = Foo a
4+
5+
instance Show1 Foo where
6+
liftShowsPrec showsPrec _showList prec (Foo a) rest = "Foo " ++ showsPrec prec a rest
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: Missing superclass declaration
3+
order: 3
4+
---
5+
6+
### Error message on GHC 9.6.2
7+
8+
```
9+
Main.hs:5:10: error: [GHC-39999]
10+
• Could not deduce ‘Show (Foo a)’
11+
arising from the head of a quantified constraint
12+
arising from the superclasses of an instance declaration
13+
from the context: Show a
14+
bound by a quantified context at Main.hs:5:10-18
15+
• In the instance declaration for ‘Show1 Foo’
16+
|
17+
5 | instance Show1 Foo where
18+
| ^^^^^^^^^
19+
```
20+
21+
## Explanation
22+
23+
The [`Show1`](https://hackage.haskell.org/package/base-4.18.0.0/docs/Data-Functor-Classes.html#t:Show1) class has
24+
changed in GHC 9.6 to require a quantified superclass constraint `Show`. To fix this error, for every `instance
25+
Show1` declaration add a corresponding `instance Show` declaration for the same data type.

message-index/messages/GHC-39999/too-polymorphic/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: A usage of `+` on a too polymorphic variable.
3+
order: 1
34
---
45

56
## Error message

0 commit comments

Comments
 (0)