summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleg Grenrus <oleg.grenrus@iki.fi>2021-04-04 17:22:11 +0300
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-04-26 23:54:34 -0400
commit045e5f49f81f98b8cfaeee08b572617a173f33da (patch)
tree572ff39370264776fc5aa4f0cac06b0745e8673b
parentd38397fa26acb2588253ffd704e212dbf55b2bf4 (diff)
downloadhaskell-045e5f49f81f98b8cfaeee08b572617a173f33da.tar.gz
Add Eq1 and Ord1 Fixed instances
-rw-r--r--libraries/base/Data/Functor/Classes.hs9
-rw-r--r--libraries/base/changelog.md3
2 files changed, 11 insertions, 1 deletions
diff --git a/libraries/base/Data/Functor/Classes.hs b/libraries/base/Data/Functor/Classes.hs
index d672c340d7..82d78778d7 100644
--- a/libraries/base/Data/Functor/Classes.hs
+++ b/libraries/base/Data/Functor/Classes.hs
@@ -74,6 +74,7 @@ import Data.Complex (Complex((:+)))
import GHC.Tuple (Solo (..))
import GHC.Read (expectP, list, paren)
+import Data.Fixed (Fixed (..))
import Text.ParserCombinators.ReadPrec (ReadPrec, readPrec_to_S, readS_to_Prec)
import Text.Read (Read(..), parens, prec, step)
@@ -870,6 +871,14 @@ instance Show1 Complex where
where
complexPrec = 6
+-- | @since 4.16.0.0
+instance Eq1 Fixed where
+ liftEq _eq (MkFixed x) (MkFixed y) = x == y
+
+-- | @since 4.16.0.0
+instance Ord1 Fixed where
+ liftCompare _cmp (MkFixed x) (MkFixed y) = compare x y
+
-- Building blocks
-- | @'readsData' p d@ is a parser for datatypes where each alternative
diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md
index 329f464620..b258f984e4 100644
--- a/libraries/base/changelog.md
+++ b/libraries/base/changelog.md
@@ -28,7 +28,8 @@
`Eq`, `Ord`, `Show`, `Read`, `Eq1`, `Ord1`, `Show1`, `Read1`, `Generic`,
`Generic1`, and `Data` instances for `GHC.Tuple.Solo`.
- * Add `Eq1`, `Read1` and `Show1` instance for `Complex`;
+ * Add `Eq1`, `Read1` and `Show1` instances for `Complex`;
+ add `Eq1` and `Ord1` instances for `Fixed;
add `Eq1/2`, `Ord1/2`, `Show1/2` and `Read1/2` instances for 3 and 4-tuples.
* Remove `Data.Semigroup.Option` and the accompanying `option` function.