File tree Expand file tree Collapse file tree 3 files changed +39
-0
lines changed
message-index/messages/GHC-39999/superclass Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
1
+ ---
2
+ title : Missing superclass declaration
3
+ ---
4
+
5
+ ### Error message on GHC 9.6.2
6
+
7
+ ```
8
+ Main.hs:5:10: error: [GHC-39999]
9
+ • Could not deduce ‘Show (Foo a)’
10
+ arising from the head of a quantified constraint
11
+ arising from the superclasses of an instance declaration
12
+ from the context: Show a
13
+ bound by a quantified context at Main.hs:5:10-18
14
+ • In the instance declaration for ‘Show1 Foo’
15
+ |
16
+ 5 | instance Show1 Foo where
17
+ | ^^^^^^^^^
18
+ ```
19
+
20
+ ## Explanation
21
+
22
+ The [ ` Show1 ` ] ( https://hackage.haskell.org/package/base-4.18.0.0/docs/Data-Functor-Classes.html#t:Show1 ) class has
23
+ changed in GHC 9.6 to require a quantified superclass constraint ` Show ` . To fix this error, for every `instance
24
+ Show1` declaration add a corresponding ` instance Show` declaration for the same data type.
You can’t perform that action at this time.
0 commit comments