generically 0.1 → 0.1.1
raw patch · 3 files changed
+24/−4 lines, 3 filesdep +base-orphansdep ~basenew-uploaderPVP ok
version bump matches the API change (PVP)
Dependencies added: base-orphans
Dependency ranges changed: base
API changes (from Hackage documentation)
+ GHC.Generics.Generically: instance forall k (f :: k -> *) (a :: k). (GHC.Generics.Generic1 f, GHC.Classes.Eq (GHC.Generics.Rep1 f a)) => GHC.Classes.Eq (GHC.Generics.Generically.Generically1 f a)
+ GHC.Generics.Generically: instance forall k (f :: k -> *) (a :: k). (GHC.Generics.Generic1 f, GHC.Classes.Ord (GHC.Generics.Rep1 f a)) => GHC.Classes.Ord (GHC.Generics.Generically.Generically1 f a)
Files
- CHANGELOG.md +7/−0
- generically.cabal +6/−3
- src/GHC/Generics/Generically.hs +11/−1
CHANGELOG.md view
@@ -1,3 +1,10 @@+# 0.1.1 -- 2023-03-10++* Backport `Eq` and `Ord` instances for `Generically1`, which were introduced+ in `base-4.18.0.0`. To ensure that these instances are in scope when building+ with `base-4.17.0.0` (in which `Generically1` is defined in `base`, not this+ library), we also add a dependency on `base-orphans`.+ # 0.1 -- 2022-06-15 * First version.
generically.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.12 name: generically-version: 0.1+version: 0.1.1 synopsis: Generically newtype to use with DerivingVia description: This is a compatibility package as @Generically@ and @Generically1@ newtypes@@ -23,8 +23,9 @@ || ==8.8.4 || ==8.10.7 || ==9.0.2- || ==9.2.3- || ==9.4.1+ || ==9.2.7+ || ==9.4.4+ || ==9.6.1 source-repository head type: git@@ -33,5 +34,7 @@ library default-language: Haskell2010 build-depends: base >=4.9 && <4.18+ if impl(ghc >= 9.4) && !impl(ghc >= 9.6)+ build-depends: base-orphans >=0.8.8 && <0.10 hs-source-dirs: src exposed-modules: GHC.Generics.Generically
src/GHC/Generics/Generically.hs view
@@ -20,6 +20,9 @@ #if MIN_VERSION_base(4,17,0) import GHC.Generics+#if !MIN_VERSION_base(4,18,0)+import Data.Orphans () -- To bring Eq/Ord instances for Generically1 into scope+#endif #else #if __GLASGOW_HASKELL__ >= 810@@ -40,7 +43,7 @@ ------------------------------------------------------------------------------- -- | A type whose instances are defined generically, using the--- 'Generic' representation. +-- 'Generic' representation. newtype Generically a = Generically a instance (Generic a, Semigroup (Rep a ())) => Semigroup (Generically a) where@@ -96,6 +99,13 @@ (<|>) :: Generically1 f a -> Generically1 f a -> Generically1 f a Generically1 as1 <|> Generically1 as2 = Generically1 (to1 (from1 as1 <|> from1 as2))++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++instance (Generic1 f, Ord (Rep1 f a)) => Ord (Generically1 f a) where+ Generically1 x `compare` Generically1 y = from1 x `compare` from1 y instance (Generic1 f, Eq1 (Rep1 f)) => Eq1 (Generically1 f) where liftEq :: (a -> b -> Bool) -> (Generically1 f a -> Generically1 f b -> Bool)