Skip to content

Commit 5013606

Browse files
QbxsBinderDavid
authored andcommitted
CR-59692 DuplicatInstances Changed Wording & module name and added description for example
1 parent d83e897 commit 5013606

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

message-index/messages/GHC-59692/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ introduced: 9.6.1
88
For type class coherence, at most one instance may be defined for each type for the same type class.
99

1010
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 numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module DivergingInstances where
1+
module MultipleInstances where
22

33
newtype Sum = Sum { getSum :: Int }
44

@@ -8,4 +8,4 @@ instance Semigroup Sum where
88
newtype Product = Product { getProduct :: Int }
99

1010
instance Semigroup Product where
11-
(<>) x y = Product (getProduct x * getProduct y)
11+
(<>) x y = Product (getProduct x * getProduct y)

message-index/messages/GHC-59692/divergingInstances/before/DivergingInstances.hs renamed to message-index/messages/GHC-59692/multipleInstances/before/MultipleInstances.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module DivergingInstances where
1+
module MultipleInstances where
22

33
instance Semigroup Int where
44
(<>) = (+)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
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`.

0 commit comments

Comments
 (0)