packages feed

base-orphans 0.8.4 → 0.8.5

raw patch · 6 files changed

+214/−8 lines, 6 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Orphans: instance (GHC.Classes.Eq a, GHC.Classes.Eq b) => Data.Functor.Classes.Eq1 ((,,) a b)
+ Data.Orphans: instance (GHC.Classes.Eq a, GHC.Classes.Eq b) => Data.Functor.Classes.Eq2 ((,,,) a b)
+ Data.Orphans: instance (GHC.Classes.Eq a, GHC.Classes.Eq b, GHC.Classes.Eq c) => Data.Functor.Classes.Eq1 ((,,,) a b c)
+ Data.Orphans: instance (GHC.Classes.Ord a, GHC.Classes.Ord b) => Data.Functor.Classes.Ord1 ((,,) a b)
+ Data.Orphans: instance (GHC.Classes.Ord a, GHC.Classes.Ord b) => Data.Functor.Classes.Ord2 ((,,,) a b)
+ Data.Orphans: instance (GHC.Classes.Ord a, GHC.Classes.Ord b, GHC.Classes.Ord c) => Data.Functor.Classes.Ord1 ((,,,) a b c)
+ Data.Orphans: instance (GHC.Read.Read a, GHC.Read.Read b) => Data.Functor.Classes.Read1 ((,,) a b)
+ Data.Orphans: instance (GHC.Read.Read a, GHC.Read.Read b) => Data.Functor.Classes.Read2 ((,,,) a b)
+ Data.Orphans: instance (GHC.Read.Read a, GHC.Read.Read b, GHC.Read.Read c) => Data.Functor.Classes.Read1 ((,,,) a b c)
+ Data.Orphans: instance (GHC.Show.Show a, GHC.Show.Show b) => Data.Functor.Classes.Show1 ((,,) a b)
+ Data.Orphans: instance (GHC.Show.Show a, GHC.Show.Show b) => Data.Functor.Classes.Show2 ((,,,) a b)
+ Data.Orphans: instance (GHC.Show.Show a, GHC.Show.Show b, GHC.Show.Show c) => Data.Functor.Classes.Show1 ((,,,) a b c)
+ Data.Orphans: instance Data.Functor.Classes.Eq1 Data.Complex.Complex
+ Data.Orphans: instance Data.Functor.Classes.Eq1 Data.Fixed.Fixed
+ Data.Orphans: instance Data.Functor.Classes.Ord1 Data.Fixed.Fixed
+ Data.Orphans: instance Data.Functor.Classes.Read1 Data.Complex.Complex
+ Data.Orphans: instance Data.Functor.Classes.Show1 Data.Complex.Complex
+ Data.Orphans: instance GHC.Classes.Eq a => Data.Functor.Classes.Eq2 ((,,) a)
+ Data.Orphans: instance GHC.Classes.Ord a => Data.Functor.Classes.Ord2 ((,,) a)
+ Data.Orphans: instance GHC.Read.Read a => Data.Functor.Classes.Read2 ((,,) a)
+ Data.Orphans: instance GHC.Show.Show a => Data.Functor.Classes.Show2 ((,,) a)
+ Data.Orphans: instance forall k (f :: k -> *) (a :: k) (g :: k -> *). (GHC.Base.Monoid (f a), GHC.Base.Monoid (g a)) => GHC.Base.Monoid (Data.Functor.Product.Product f g a)
+ Data.Orphans: instance forall k (f :: k -> *) (a :: k) (g :: k -> *). (GHC.Base.Semigroup (f a), GHC.Base.Semigroup (g a)) => GHC.Base.Semigroup (Data.Functor.Product.Product f g a)
+ Data.Orphans: instance forall k k1 (f :: k -> *) (g :: k1 -> k) (a :: k1). GHC.Base.Monoid (f (g a)) => GHC.Base.Monoid (Data.Functor.Compose.Compose f g a)
+ Data.Orphans: instance forall k k1 (f :: k -> *) (g :: k1 -> k) (a :: k1). GHC.Base.Semigroup (f (g a)) => GHC.Base.Semigroup (Data.Functor.Compose.Compose f g a)

Files

CHANGES.markdown view
@@ -1,3 +1,12 @@+## Changes in 0.8.5 [2021.08.29]+ - Backport new instances from GHC 9.2/`base-4.16`+   * `Eq1`, `Read1`, and `Show1` instances for `Complex`+   * `Eq1` and `Ord1` instances for `Fixed`+   * `Eq{1,2}`, `Ord{1,2}`, `Show{1,2}`, and `Read{1,2}` instances for `(,,)`+      and `(,,,)`+   * `Semigroup` and `Monoid` instances for `Data.Functor.Product` and+     `Data.Functor.Compose`+ ## Changes in 0.8.4 [2020.12.09]  - Backport the `Ord` instances for `TyCon` and `TypeRep` to be available on    GHC 7.0.
README.markdown view
@@ -3,7 +3,7 @@ [![Hackage Dependencies](https://img.shields.io/hackage-deps/v/base-orphans.svg)](http://packdeps.haskellers.com/reverse/base-orphans) [![Haskell Programming Language](https://img.shields.io/badge/language-Haskell-blue.svg)][Haskell.org] [![BSD3 License](http://img.shields.io/badge/license-MIT-brightgreen.svg)][tl;dr Legal: MIT]-[![Build](https://img.shields.io/travis/haskell-compat/base-orphans.svg)](https://travis-ci.org/haskell-compat/base-orphans)+[![Build Status](https://github.com/haskell-compat/base-orphans/workflows/Haskell-CI/badge.svg)](https://github.com/haskell-compat/base-orphans/actions?query=workflow%3AHaskell-CI)  [Hackage: base-orphans]:   http://hackage.haskell.org/package/base-orphans@@ -52,8 +52,11 @@  * `Data`, `MonadFix` and `MonadZip` instances for `Alt`, `Dual`, `First`, `Last`,    `Product`, and `Sum`  * `Data` and `IsList` instances for `Version` and `ZipList`+ * `Eq{1,2}`, `Ord{1,2}`, `Show{1,2}`, and `Read{1,2}` instances for `(,,)` and `(,,,)`  * `Eq` and `Ord` instances for `Control.Exception.ErrorCall`  * `Eq`, `Ord`, `Read`, and `Show` instances for data types in `GHC.Generics`+ * `Eq1`, `Read1`, and `Show1` instances for `Complex`+ * `Eq1` and `Ord1` instances for `Fixed`  * `Eq1`, `Ord1`, `Read1`, and `Show1` instances for `NonEmpty`  * `Foldable` instance for `Either`, `(,)` and `Const`  * `Foldable` and `Traversable` instances for `Alt` from `Data.Monoid`@@ -76,6 +79,7 @@  * `Semigroup` instances for `IO`, `Event` and `Lifetime`  * `Semigroup` instances for `V1`, `U1`, `Par1`, `Rec1`, `K1`, `M1`, `(:*:)`, and `(:.:)` from `GHC.Generics`.    `Monoid` instances for the same types (except `V1`).+ * `Semigroup` and `Monoid` instances for `Data.Functor.Product` and `Data.Functor.Compose`  * `Show` instance for `Fingerprint`  * `Storable` instance for `()`, `Complex`, and `Ratio`  * `TestEquality` instance for `Compose`@@ -96,6 +100,7 @@  ## Supported versions of GHC/`base` + * `ghc-9.2.*`  / `base-4.16.*`  * `ghc-9.0.*`  / `base-4.15.*`  * `ghc-8.10.*` / `base-4.14.*`  * `ghc-8.8.*`  / `base-4.13.*`
base-orphans.cabal view
@@ -7,7 +7,7 @@ -- hash: 3f7729521eafb32086f9ec5393064162845096085d8c2302ff44044aecc88db3  name:                base-orphans-version:             0.8.4+version:             0.8.5 synopsis:            Backwards-compatible orphan instances for base description:         @base-orphans@ defines orphan instances that mimic instances available in                      later versions of @base@ to a wider (older) range of compilers.@@ -35,7 +35,7 @@ license:             MIT license-file:        LICENSE build-type:          Simple-tested-with:         GHC == 7.0.4 , GHC == 7.2.2 , GHC == 7.4.2 , GHC == 7.6.3 , GHC == 7.8.4 , GHC == 7.10.3 , GHC == 8.0.2 , GHC == 8.2.2 , GHC == 8.4.4 , GHC == 8.6.5 , GHC == 8.8.3 , GHC == 8.10.1+tested-with:         GHC == 7.0.4 , GHC == 7.2.2 , GHC == 7.4.2 , GHC == 7.6.3 , GHC == 7.8.4 , GHC == 7.10.3 , GHC == 8.0.2 , GHC == 8.2.2 , GHC == 8.4.4 , GHC == 8.6.5 , GHC == 8.8.4 , GHC == 8.10.7, GHC == 9.0.1, GHC == 9.2.* extra-source-files:     CHANGES.markdown     README.markdown
src/Data/Orphans.hs view
@@ -38,7 +38,7 @@ module Data.Orphans () where  #if __GLASGOW_HASKELL__ >= 701 && !(MIN_VERSION_base(4,12,0))-import           GHC.Generics as Generics+import           GHC.Generics as Generics hiding (prec) #endif  #if !(MIN_VERSION_base(4,6,0))@@ -48,13 +48,20 @@ #if !(MIN_VERSION_base(4,9,0)) import qualified Data.Monoid as Monoid import           Text.ParserCombinators.ReadPrec as ReadPrec-import           Text.Read as Read #endif  #if MIN_VERSION_base(4,9,0) && !(MIN_VERSION_base(4,11,0)) import qualified Control.Monad.Fail as Fail (MonadFail(..)) #endif +#if MIN_VERSION_base(4,9,0) && !(MIN_VERSION_base(4,16,0))+import qualified Data.Functor.Product as Functor+#endif++#if MIN_VERSION_base(4,10,0) && !(MIN_VERSION_base(4,16,0))+import           GHC.Read (expectP, paren)+#endif+ #if !(MIN_VERSION_base(4,10,0)) import           Data.Data as Data #endif@@ -80,7 +87,7 @@ # endif #endif -#if !(MIN_VERSION_base(4,15,0))+#if !(MIN_VERSION_base(4,16,0)) import           Data.Orphans.Prelude #endif @@ -1620,6 +1627,184 @@  instance MonadFix Complex where   mfix f = (let a :+ _ = f a in a) :+ (let _ :+ a = f a in a)+# endif+#endif++#if !(MIN_VERSION_base(4,16,0))+# if MIN_VERSION_base(4,9,0)+instance Eq1 Complex where+    liftEq eq (x :+ y) (u :+ v) = eq x u && eq y v++instance Read1 Complex where+#  if MIN_VERSION_base(4,10,0)+    liftReadPrec rp _  = parens $ prec complexPrec $ do+        x <- step rp+        expectP (Symbol ":+")+        y <- step rp+        return (x :+ y)+      where+        complexPrec = 6++    liftReadListPrec = liftReadListPrecDefault+    liftReadList     = liftReadListDefault+#  else+    liftReadsPrec rdP _ p s = readParen (p > complexPrec) (\s' -> do+      (x, s'')     <- rdP (complexPrec+1) s'+      (":+", s''') <- lex s''+      (y, s'''')   <- rdP (complexPrec+1) s'''+      return (x :+ y, s'''')) s+      where+        complexPrec = 6+#  endif++instance Show1 Complex where+    liftShowsPrec sp _ d (x :+ y) = showParen (d > complexPrec) $+        sp (complexPrec+1) x . showString " :+ " . sp (complexPrec+1) y+      where+        complexPrec = 6++instance Eq1 Fixed where+    liftEq _eq (MkFixed x) (MkFixed y) = x == y++instance Ord1 Fixed where+    liftCompare _cmp (MkFixed x) (MkFixed y) = compare x y++instance Eq a => Eq2 ((,,) a) where+    liftEq2 e1 e2 (u1, x1, y1) (v1, x2, y2) =+        u1 == v1 &&+        e1 x1 x2 && e2 y1 y2++instance Ord a => Ord2 ((,,) a) where+    liftCompare2 comp1 comp2 (u1, x1, y1) (v1, x2, y2) =+        compare u1 v1 `mappend`+        comp1 x1 x2 `mappend` comp2 y1 y2++instance Read a => Read2 ((,,) a) where+#  if MIN_VERSION_base(4,10,0)+    liftReadPrec2 rp1 _ rp2 _ = parens $ paren $ do+        x1 <- readPrec+        expectP (Punc ",")+        y1 <- rp1+        expectP (Punc ",")+        y2 <- rp2+        return (x1,y1,y2)++    liftReadListPrec2 = liftReadListPrec2Default+    liftReadList2     = liftReadList2Default+#  else+    liftReadsPrec2 rp1 _ rp2 _ _ = readParen False $ \ r ->+        [((e1,e2,e3), y) | ("(",s) <- lex r,+                           (e1,t)  <- readsPrec 0 s,+                           (",",u) <- lex t,+                           (e2,v)  <- rp1 0 u,+                           (",",w) <- lex v,+                           (e3,x)  <- rp2 0 w,+                           (")",y) <- lex x]+#  endif++instance Show a => Show2 ((,,) a) where+    liftShowsPrec2 sp1 _ sp2 _ _ (x1,y1,y2)+        = showChar '(' . showsPrec 0 x1+        . showChar ',' . sp1 0 y1+        . showChar ',' . sp2 0 y2+        . showChar ')'++instance (Eq a, Eq b) => Eq1 ((,,) a b) where+    liftEq = liftEq2 (==)++instance (Ord a, Ord b) => Ord1 ((,,) a b) where+    liftCompare = liftCompare2 compare++instance (Read a, Read b) => Read1 ((,,) a b) where+#  if MIN_VERSION_base(4,10,0)+    liftReadPrec = liftReadPrec2 readPrec readListPrec++    liftReadListPrec = liftReadListPrecDefault+    liftReadList     = liftReadListDefault+#  else+    liftReadsPrec = liftReadsPrec2 readsPrec readList+#  endif++instance (Show a, Show b) => Show1 ((,,) a b) where+    liftShowsPrec = liftShowsPrec2 showsPrec showList++instance (Eq a, Eq b) => Eq2 ((,,,) a b) where+    liftEq2 e1 e2 (u1, u2, x1, y1) (v1, v2, x2, y2) =+        u1 == v1 &&+        u2 == v2 &&+        e1 x1 x2 && e2 y1 y2++instance (Ord a, Ord b) => Ord2 ((,,,) a b) where+    liftCompare2 comp1 comp2 (u1, u2, x1, y1) (v1, v2, x2, y2) =+        compare u1 v1 `mappend`+        compare u2 v2 `mappend`+        comp1 x1 x2 `mappend` comp2 y1 y2++instance (Read a, Read b) => Read2 ((,,,) a b) where+#  if MIN_VERSION_base(4,10,0)+    liftReadPrec2 rp1 _ rp2 _ = parens $ paren $ do+        x1 <- readPrec+        expectP (Punc ",")+        x2 <- readPrec+        expectP (Punc ",")+        y1 <- rp1+        expectP (Punc ",")+        y2 <- rp2+        return (x1,x2,y1,y2)++    liftReadListPrec2 = liftReadListPrec2Default+    liftReadList2     = liftReadList2Default+#  else+    liftReadsPrec2 rp1 _ rp2 _ _ = readParen False $ \ r ->+        [((e1,e2,e3,e4), s9) | ("(",s1) <- lex r,+                               (e1,s2)  <- readsPrec 0 s1,+                               (",",s3) <- lex s2,+                               (e2,s4)  <- readsPrec 0 s3,+                               (",",s5) <- lex s4,+                               (e3,s6)  <- rp1 0 s5,+                               (",",s7) <- lex s6,+                               (e4,s8)  <- rp2 0 s7,+                               (")",s9) <- lex s8]+#  endif++instance (Show a, Show b) => Show2 ((,,,) a b) where+    liftShowsPrec2 sp1 _ sp2 _ _ (x1,x2,y1,y2)+        = showChar '(' . showsPrec 0 x1+        . showChar ',' . showsPrec 0 x2+        . showChar ',' . sp1 0 y1+        . showChar ',' . sp2 0 y2+        . showChar ')'++instance (Eq a, Eq b, Eq c) => Eq1 ((,,,) a b c) where+    liftEq = liftEq2 (==)++instance (Ord a, Ord b, Ord c) => Ord1 ((,,,) a b c) where+    liftCompare = liftCompare2 compare++instance (Read a, Read b, Read c) => Read1 ((,,,) a b c) where+#  if MIN_VERSION_base(4,10,0)+    liftReadPrec = liftReadPrec2 readPrec readListPrec++    liftReadListPrec = liftReadListPrecDefault+    liftReadList     = liftReadListDefault+#  else+    liftReadsPrec = liftReadsPrec2 readsPrec readList+#  endif++instance (Show a, Show b, Show c) => Show1 ((,,,) a b c) where+    liftShowsPrec = liftShowsPrec2 showsPrec showList++deriving instance Semigroup (f (g a)) => Semigroup (Compose f g a)+deriving instance Monoid    (f (g a)) => Monoid    (Compose f g a)++instance (Semigroup (f a), Semigroup (g a)) => Semigroup (Functor.Product f g a) where+    Functor.Pair x1 y1 <> Functor.Pair x2 y2 = Functor.Pair (x1 <> x2) (y1 <> y2)++instance (Monoid (f a), Monoid (g a)) => Monoid (Functor.Product f g a) where+    mempty = Functor.Pair mempty mempty+#  if !(MIN_VERSION_base(4,11,0))+    Functor.Pair x1 y1 `mappend` Functor.Pair x2 y2 = Functor.Pair (x1 `mappend` x2) (y1 `mappend` y2)+#  endif # endif #endif 
src/Data/Orphans/Prelude.hs view
@@ -21,7 +21,7 @@ Note that this module does not export any modules that could introduce name clashes. -} module Data.Orphans.Prelude-#if MIN_VERSION_base(4,15,0)+#if MIN_VERSION_base(4,16,0)     () where #else     ( module OrphansPrelude@@ -37,7 +37,7 @@     ) where  import Control.Applicative as OrphansPrelude-import Control.Arrow as OrphansPrelude hiding (first, loop, second)+import Control.Arrow as OrphansPrelude hiding ((+++), first, loop, second) import Control.Category as OrphansPrelude hiding ((.), id) import Control.Concurrent.QSem as OrphansPrelude import Control.Monad as OrphansPrelude hiding (mapM, sequence)@@ -89,6 +89,7 @@ import System.Posix.Types as OrphansPrelude  import Text.Printf as OrphansPrelude+import Text.Read as OrphansPrelude  import Unsafe.Coerce as OrphansPrelude (unsafeCoerce) @@ -103,6 +104,9 @@  #  if !defined(mingw32_HOST_OS) && !defined(__GHCJS__) import GHC.Event as OrphansPrelude+#   if !(MIN_VERSION_base(4,7,0))+      hiding (step)+#   endif #  endif # endif 
test/Control/Applicative/OrphansSpec.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} module Control.Applicative.OrphansSpec (main, spec) where  import Test.Hspec@@ -17,7 +18,9 @@   Identity f <*> x = f <$> x  instance Monad Identity where+#if !(MIN_VERSION_base(4,11,0))   return = Identity+#endif   m >>= k  = k (runIdentity m)  main :: IO ()