File tree Expand file tree Collapse file tree 4 files changed +10
-4
lines changed
message-index/messages/GHC-59692 Expand file tree Collapse file tree 4 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -8,4 +8,4 @@ introduced: 9.6.1
8
8
For type class coherence, at most one instance may be defined for each type for the same type class.
9
9
10
10
Identical instances should simply be removed.
11
- If for the same type diverging instances are required, circumventing this restriction is possible by introducing a ` newtype ` wrapper.
11
+ If multiple instances for the same type are required, circumventing this restriction is possible by introducing a ` newtype ` wrapper.
Original file line number Diff line number Diff line change 1
- module DivergingInstances where
1
+ module MultipleInstances where
2
2
3
3
newtype Sum = Sum { getSum :: Int }
4
4
@@ -8,4 +8,4 @@ instance Semigroup Sum where
8
8
newtype Product = Product { getProduct :: Int }
9
9
10
10
instance Semigroup Product where
11
- (<>) x y = Product (getProduct x * getProduct y)
11
+ (<>) x y = Product (getProduct x * getProduct y)
Original file line number Diff line number Diff line change 1
- module DivergingInstances where
1
+ module MultipleInstances where
2
2
3
3
instance Semigroup Int where
4
4
(<>) = (+)
Original file line number Diff line number Diff line change
1
+ ---
2
+ title : Multiple Instances for Semigroup Int
3
+ ---
4
+
5
+ Different definitiones for ` Semigroup Int ` are possible.
6
+ If we more than one, we ought to wrap ` Int ` in a ` newtype ` .
You can’t perform that action at this time.
0 commit comments