diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2022-08-13 09:08:17 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-09-20 13:11:49 -0400 |
commit | c4c2cca012c139259ab40e5b2e5f43aafc8f49c0 (patch) | |
tree | 0cc3568c44db72c5018bffdcea6fc5e73fc4159d | |
parent | 59fe128c37b2befb1ece4bf3f8f5c9082bd213eb (diff) | |
download | haskell-c4c2cca012c139259ab40e5b2e5f43aafc8f49c0.tar.gz |
Add `Eq` and `Ord` instances for `Generically1`
These are needed so the subsequent commit overhauling the `*1` classes
type-checks.
-rw-r--r-- | libraries/base/GHC/Generics.hs | 9 | ||||
-rw-r--r-- | libraries/base/changelog.md | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/libraries/base/GHC/Generics.hs b/libraries/base/GHC/Generics.hs index 6ce5b70083..66ee8ba300 100644 --- a/libraries/base/GHC/Generics.hs +++ b/libraries/base/GHC/Generics.hs @@ -1480,6 +1480,15 @@ type Generically1 :: forall k. (k -> Type) -> (k -> Type) newtype Generically1 f a where Generically1 :: forall {k} f a. f a -> Generically1 @k f a +-- | @since 4.18.0.0 +instance (Generic1 f, Eq (Rep1 f a)) => Eq (Generically1 f a) where + Generically1 x == Generically1 y = from1 x == from1 y + Generically1 x /= Generically1 y = from1 x /= from1 y + +-- | @since 4.18.0.0 +instance (Generic1 f, Ord (Rep1 f a)) => Ord (Generically1 f a) where + Generically1 x `compare` Generically1 y = from1 x `compare` from1 y + -- | @since 4.17.0.0 instance (Generic1 f, Functor (Rep1 f)) => Functor (Generically1 f) where fmap :: (a -> a') -> (Generically1 f a -> Generically1 f a') diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index 8e24ce47a9..515e398798 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -30,6 +30,7 @@ for the related discussion, as well as [the migration guide](https://github.com/haskell/core-libraries-committee/blob/main/guides/export-lifta2-prelude.md) * Update to Unicode 15.0.0. + * Add `Eq` and `Ord` instances for `Generically1`. ## 4.17.0.0 *August 2022* |