packages feed

base-orphans 0.4.5 → 0.5.0

raw patch · 5 files changed

+350/−88 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Orphans: instance (Data.Data.Data (f a), Data.Typeable.Internal.Typeable f, Data.Typeable.Internal.Typeable a) => Data.Data.Data (Data.Monoid.Alt f a)
+ Data.Orphans: instance Control.Monad.Fix.MonadFix Data.Monoid.Dual
+ Data.Orphans: instance Control.Monad.Fix.MonadFix Data.Monoid.First
+ Data.Orphans: instance Control.Monad.Fix.MonadFix Data.Monoid.Last
+ Data.Orphans: instance Control.Monad.Fix.MonadFix Data.Monoid.Product
+ Data.Orphans: instance Control.Monad.Fix.MonadFix Data.Monoid.Sum
+ Data.Orphans: instance Control.Monad.Fix.MonadFix f => Control.Monad.Fix.MonadFix (Data.Monoid.Alt f)
+ Data.Orphans: instance Control.Monad.Zip.MonadZip Data.Monoid.Dual
+ Data.Orphans: instance Control.Monad.Zip.MonadZip Data.Monoid.First
+ Data.Orphans: instance Control.Monad.Zip.MonadZip Data.Monoid.Last
+ Data.Orphans: instance Control.Monad.Zip.MonadZip Data.Monoid.Product
+ Data.Orphans: instance Control.Monad.Zip.MonadZip Data.Monoid.Sum
+ Data.Orphans: instance Control.Monad.Zip.MonadZip GHC.Base.Maybe
+ Data.Orphans: instance Control.Monad.Zip.MonadZip f => Control.Monad.Zip.MonadZip (Data.Monoid.Alt f)
+ Data.Orphans: instance Data.Data.Data Data.Monoid.All
+ Data.Orphans: instance Data.Data.Data Data.Monoid.Any
+ Data.Orphans: instance Data.Data.Data a => Data.Data.Data (Data.Monoid.Dual a)
+ Data.Orphans: instance Data.Data.Data a => Data.Data.Data (Data.Monoid.First a)
+ Data.Orphans: instance Data.Data.Data a => Data.Data.Data (Data.Monoid.Last a)
+ Data.Orphans: instance Data.Data.Data a => Data.Data.Data (Data.Monoid.Product a)
+ Data.Orphans: instance Data.Data.Data a => Data.Data.Data (Data.Monoid.Sum a)
+ Data.Orphans: instance Data.Foldable.Foldable Control.Applicative.ZipList
+ Data.Orphans: instance Data.Foldable.Foldable Data.Complex.Complex
+ Data.Orphans: instance Data.Foldable.Foldable Data.Monoid.Dual
+ Data.Orphans: instance Data.Foldable.Foldable Data.Monoid.First
+ Data.Orphans: instance Data.Foldable.Foldable Data.Monoid.Last
+ Data.Orphans: instance Data.Foldable.Foldable Data.Monoid.Product
+ Data.Orphans: instance Data.Foldable.Foldable Data.Monoid.Sum
+ Data.Orphans: instance Data.Traversable.Traversable Control.Applicative.ZipList
+ Data.Orphans: instance Data.Traversable.Traversable Data.Complex.Complex
+ Data.Orphans: instance Data.Traversable.Traversable Data.Monoid.Dual
+ Data.Orphans: instance Data.Traversable.Traversable Data.Monoid.First
+ Data.Orphans: instance Data.Traversable.Traversable Data.Monoid.Last
+ Data.Orphans: instance Data.Traversable.Traversable Data.Monoid.Product
+ Data.Orphans: instance Data.Traversable.Traversable Data.Monoid.Sum
+ Data.Orphans: instance Foreign.Storable.Storable ()
+ Data.Orphans: instance Foreign.Storable.Storable a => Foreign.Storable.Storable (Control.Applicative.Const a b)
+ Data.Orphans: instance Foreign.Storable.Storable a => Foreign.Storable.Storable (Data.Functor.Identity.Identity a)
+ Data.Orphans: instance GHC.Arr.Ix a => GHC.Arr.Ix (Control.Applicative.Const a b)
+ Data.Orphans: instance GHC.Arr.Ix a => GHC.Arr.Ix (Data.Functor.Identity.Identity a)
+ Data.Orphans: instance GHC.Base.Applicative Data.Complex.Complex
+ Data.Orphans: instance GHC.Base.Applicative Data.Monoid.Dual
+ Data.Orphans: instance GHC.Base.Applicative Data.Monoid.Product
+ Data.Orphans: instance GHC.Base.Applicative Data.Monoid.Sum
+ Data.Orphans: instance GHC.Base.Functor Data.Complex.Complex
+ Data.Orphans: instance GHC.Base.Functor Data.Monoid.Dual
+ Data.Orphans: instance GHC.Base.Functor Data.Monoid.Product
+ Data.Orphans: instance GHC.Base.Functor Data.Monoid.Sum
+ Data.Orphans: instance GHC.Base.Monad Data.Complex.Complex
+ Data.Orphans: instance GHC.Base.Monad Data.Monoid.Dual
+ Data.Orphans: instance GHC.Base.Monad Data.Monoid.Product
+ Data.Orphans: instance GHC.Base.Monad Data.Monoid.Sum
+ Data.Orphans: instance GHC.Base.Monoid a => GHC.Base.Monad ((,) a)
+ Data.Orphans: instance GHC.Base.Monoid a => GHC.Base.Monoid (Data.Functor.Identity.Identity a)
+ Data.Orphans: instance GHC.Base.Monoid a => GHC.Base.Monoid (GHC.Types.IO a)
+ Data.Orphans: instance GHC.Enum.Bounded a => GHC.Enum.Bounded (Control.Applicative.Const a b)
+ Data.Orphans: instance GHC.Enum.Bounded a => GHC.Enum.Bounded (Data.Functor.Identity.Identity a)
+ Data.Orphans: instance GHC.Enum.Enum a => GHC.Enum.Enum (Control.Applicative.Const a b)
+ Data.Orphans: instance GHC.Enum.Enum a => GHC.Enum.Enum (Data.Functor.Identity.Identity a)

Files

CHANGES.markdown view
@@ -1,3 +1,8 @@+## Changes in 0.5.0+ - GHC 8.0 compatibility+ - Backported instances introduced in GHC 8.0/`base-4.9`+   (see https://github.com/haskell-compat/base-orphans/issues/32)+ ## Changes in 0.4.5  - Import `Control.Monad.Instances` (which exports `Functor` and `Monad`    instances for `(->) r`, and `Functor` instances for `(,) a` and `Either a`)
README.markdown view
@@ -31,25 +31,33 @@  ## What is covered - * Added `Applicative` and `Alternative` instances for `ReadP` and `ReadPrec`- * Added `Bits`, `Bounded`, and `Integral` instances for `CDev`- * Added `Eq` and `Ord` instances for `Control.Exception.ErrorCall`- * Added `Eq`, `Ord`, `Read`, and `Show` instances for data types in `GHC.Generics`- * Added `Functor`, `Applicative`, `Alternative`, and `MonadPlus` instances for `ArrowMonad`- * Added `Functor`, `Applicative`, and `Monad` instances for `First` and `Last`- * Added `Monoid`, `Eq`, `Ord`, `Read`, and `Show` instances for `Const`- * Added `Read` and `Show` instances for `Down`- * Added `Eq`, `Ord`, `Read`, and `Show` instances for `ZipList`- * Added `Monad` instance for `WrappedMonad`- * Added `Data` and `IsList` instances for `Version`+ * `Applicative` and `Alternative` instances for `ReadP` and `ReadPrec`  * `Applicative` instance for strict and lazy `ST`+ * `Applicative`, `Foldable`, `Functor`, `Monad`, and `Traversable` instances for `Complex`,+   `Dual`, `First`, `Last`, `Product`, and `Sum`  * `Bits` instance for `Bool`+ * `Bits`, `Bounded`, and `Integral` instances for `CDev`+ * `Bounded`, `Enum`, `Ix`, and `Storable` instances for `Const` and `Identity`+ * `Data` instances for `All` and `Any`+ * `Data`, `MonadFix` and `MonadZip` instances for `Alt`, `Dual`, `First`, `Last`,+   `Product`, and `Sum`+ * `Data` and `IsList` instances for `Version`+ * `Eq` and `Ord` instances for `Control.Exception.ErrorCall`+ * `Eq`, `Ord`, `Read`, and `Show` instances for data types in `GHC.Generics`+ * `Eq`, `Ord`, `Read`, `Show`, `Foldable`, and `Traversable` instances for `ZipList`  * `Foldable` instance for `Either`, `(,)` and `Const`  * `Functor` instance for `Handler`, `ArgOrder`, `OptDescr`, and `ArgDescr`+ * `Functor`, `Applicative`, `Alternative`, and `MonadPlus` instances for `ArrowMonad`+ * `Monad` instance for `(,)`+ * `Monad` instance for `WrappedMonad`+ * `MonadZip` instance for `Maybe`+ * `Monoid`, `Eq`, `Ord`, `Read`, and `Show` instances for `Const`+ * `Monoid` instances for `Identity` and `IO`  * `Num` instance for `Sum` and `Product`  * `Read` instance for `Fixed`+ * `Read` and `Show` instances for `Down`  * `Show` instance for `Fingerprint`- * `Storable` instance for `Complex` and `Ratio`+ * `Storable` instance for `()`, `Complex`, and `Ratio`  * `Traversable` instance for `Either`, `(,)` and `Const`  * `Typeable` instance for most data types, typeclasses, and promoted data constructors (when possible) @@ -60,9 +68,14 @@   [`Generics.Deriving.Instances`](https://hackage.haskell.org/package/generic-deriving-1.8.0/docs/Generics-Deriving-Instances.html)   module of the [`generic-deriving`](https://hackage.haskell.org/package/generic-deriving)   library.+* The `Alternative IO` and `MonadPlus IO` instances. These can be found in the+  [`Control.Monad.Trans.Error`](http://hackage.haskell.org/package/transformers-0.4.3.0/docs/src/Control-Monad-Trans-Error.html#line-69)+  module of the [`transformers`](http://hackage.haskell.org/package/transformers) library.  ## Supported versions of GHC/`base` + * `ghc-8.0.1`  / `base-4.9.0.0`+ * `ghc-7.10.3` / `base-4.8.2.0`  * `ghc-7.10.2` / `base-4.8.1.0`  * `ghc-7.10.1` / `base-4.8.0.0`  * `ghc-7.8.4`  / `base-4.7.0.2`
base-orphans.cabal view
@@ -1,71 +1,71 @@--- This file has been generated from package.yaml by hpack version 0.8.0.
---
--- see: https://github.com/sol/hpack
-
-name:                base-orphans
-version:             0.4.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. @base-orphans@ does not export anything except the orphan instances themselves and complements @<http://hackage.haskell.org/package/base-compat base-compat>@.
-                     See the README for what instances are covered: <https://github.com/haskell-compat/base-orphans#readme>. See also the <https://github.com/haskell-compat/base-orphans#what-is-not-covered what is not covered> section.
-category:            Compatibility
-homepage:            https://github.com/haskell-compat/base-orphans#readme
-bug-reports:         https://github.com/haskell-compat/base-orphans/issues
-author:              Simon Hengel <sol@typeful.net>,
-                     João Cristóvão <jmacristovao@gmail.com>,
-                     Ryan Scott <ryan.gl.scott@gmail.com>
-maintainer:          Simon Hengel <sol@typeful.net>,
-                     João Cristóvão <jmacristovao@gmail.com>,
-                     Ryan Scott <ryan.gl.scott@gmail.com>
-copyright:           (c) 2012-2015 Simon Hengel,
-                     (c) 2014 João Cristóvão,
-                     (c) 2015 Ryan Scott
-license:             MIT
-license-file:        LICENSE
-build-type:          Simple
-cabal-version:       >= 1.10
-
-extra-source-files:
-  CHANGES.markdown
-  README.markdown
-
-source-repository head
-  type: git
-  location: https://github.com/haskell-compat/base-orphans
-
-library
-  hs-source-dirs:
-    src
-  ghc-options: -Wall
-  build-depends:
-    base >= 4.3 && < 5,
-    ghc-prim
-  exposed-modules:
-    Data.Orphans
-  other-modules:
-    Data.Orphans.Prelude
-  default-language: Haskell2010
-
-test-suite spec
-  type: exitcode-stdio-1.0
-  main-is: Spec.hs
-  hs-source-dirs:
-    test
-  ghc-options: -Wall
-  build-depends:
-    base >= 4.3 && < 5,
-    base-orphans,
-    hspec == 2.*,
-    QuickCheck
-  other-modules:
-    Control.Applicative.OrphansSpec
-    Control.Exception.OrphansSpec
-    Data.Bits.OrphansSpec
-    Data.Foldable.OrphansSpec
-    Data.Monoid.OrphansSpec
-    Data.Traversable.OrphansSpec
-    Data.Version.OrphansSpec
-    Foreign.Storable.OrphansSpec
-    GHC.Fingerprint.OrphansSpec
-    System.Posix.Types.IntWord
-    System.Posix.Types.OrphansSpec
-  default-language: Haskell2010
+-- This file has been generated from package.yaml by hpack version 0.8.0.+--+-- see: https://github.com/sol/hpack++name:                base-orphans+version:             0.5.0+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. @base-orphans@ does not export anything except the orphan instances themselves and complements @<http://hackage.haskell.org/package/base-compat base-compat>@.+                     See the README for what instances are covered: <https://github.com/haskell-compat/base-orphans#readme>. See also the <https://github.com/haskell-compat/base-orphans#what-is-not-covered what is not covered> section.+category:            Compatibility+homepage:            https://github.com/haskell-compat/base-orphans#readme+bug-reports:         https://github.com/haskell-compat/base-orphans/issues+author:              Simon Hengel <sol@typeful.net>,+                     João Cristóvão <jmacristovao@gmail.com>,+                     Ryan Scott <ryan.gl.scott@gmail.com>+maintainer:          Simon Hengel <sol@typeful.net>,+                     João Cristóvão <jmacristovao@gmail.com>,+                     Ryan Scott <ryan.gl.scott@gmail.com>+copyright:           (c) 2012-2015 Simon Hengel,+                     (c) 2014 João Cristóvão,+                     (c) 2015 Ryan Scott+license:             MIT+license-file:        LICENSE+build-type:          Simple+cabal-version:       >= 1.10++extra-source-files:+  CHANGES.markdown+  README.markdown++source-repository head+  type: git+  location: https://github.com/haskell-compat/base-orphans++library+  hs-source-dirs:+    src+  ghc-options: -Wall+  build-depends:+    base >= 4.3 && < 5,+    ghc-prim+  exposed-modules:+    Data.Orphans+  other-modules:+    Data.Orphans.Prelude+  default-language: Haskell2010++test-suite spec+  type: exitcode-stdio-1.0+  main-is: Spec.hs+  hs-source-dirs:+    test+  ghc-options: -Wall+  build-depends:+    base >= 4.3 && < 5,+    base-orphans,+    hspec == 2.*,+    QuickCheck+  other-modules:+    Control.Applicative.OrphansSpec+    Control.Exception.OrphansSpec+    Data.Bits.OrphansSpec+    Data.Foldable.OrphansSpec+    Data.Monoid.OrphansSpec+    Data.Traversable.OrphansSpec+    Data.Version.OrphansSpec+    Foreign.Storable.OrphansSpec+    GHC.Fingerprint.OrphansSpec+    System.Posix.Types.IntWord+    System.Posix.Types.OrphansSpec+  default-language: Haskell2010
src/Data/Orphans.hs view
@@ -5,6 +5,7 @@ {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE KindSignatures #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-}@@ -42,13 +43,16 @@ import           Control.Monad.Instances () #endif -#if __GLASGOW_HASKELL__ < 710-import           Control.Exception as Exception-import           Control.Monad.ST.Lazy as Lazy+#if !(MIN_VERSION_base(4,9,0)) import           Data.Data as Data import qualified Data.Foldable as F (Foldable(..)) import           Data.Monoid as Monoid import qualified Data.Traversable as T (Traversable(..))+#endif++#if __GLASGOW_HASKELL__ < 710+import           Control.Exception as Exception+import           Control.Monad.ST.Lazy as Lazy import           GHC.Exts as Exts import           GHC.IO.Exception as Exception import           Text.ParserCombinators.ReadP as ReadP@@ -60,7 +64,7 @@ # endif #endif -#if !(MIN_VERSION_base(4,8,0))+#if !(MIN_VERSION_base(4,9,0)) import           Data.Orphans.Prelude #endif @@ -390,6 +394,242 @@                         q <-return $  (castPtr p)                         poke q r                         pokeElemOff q 1 i+#endif++#if !(MIN_VERSION_base(4,9,0))+instance Storable () where+  sizeOf _ = 0+  alignment _ = 1+  peek _ = return ()+  poke _ _ = return ()++deriving instance Bounded a  => Bounded (Const a b)+deriving instance Enum a     => Enum (Const a b)+deriving instance Ix a       => Ix (Const a b)+deriving instance Storable a => Storable (Const a b)++deriving instance           Data All+deriving instance           Data Monoid.Any+deriving instance Data a => Data (Dual a)+deriving instance Data a => Data (First a)+deriving instance Data a => Data (Last a)+deriving instance Data a => Data (Product a)+deriving instance Data a => Data (Sum a)++instance F.Foldable Dual where+    foldMap            = coerce++    foldl              = coerce+    foldl1 _           = getDual+    foldr f z (Dual x) = f x z+    foldr1 _           = getDual+# if MIN_VERSION_base(4,6,0)+    foldl'             = coerce+    foldr'             = F.foldr+# endif+# if MIN_VERSION_base(4,8,0)+    elem               = (. getDual) #. (==)+    length _           = 1+    maximum            = getDual+    minimum            = getDual+    null _             = False+    product            = getDual+    sum                = getDual+    toList (Dual x)    = [x]+# endif++instance F.Foldable Sum where+    foldMap            = coerce++    foldl              = coerce+    foldl1 _           = getSum+    foldr f z (Sum x)  = f x z+    foldr1 _           = getSum+# if MIN_VERSION_base(4,6,0)+    foldl'                = coerce+    foldr'                = F.foldr+# endif+# if MIN_VERSION_base(4,8,0)+    elem               = (. getSum) #. (==)+    length _           = 1+    maximum            = getSum+    minimum            = getSum+    null _             = False+    product            = getSum+    sum                = getSum+    toList (Sum x)     = [x]+# endif++instance F.Foldable Product where+    foldMap               = coerce++    foldl                 = coerce+    foldl1 _              = getProduct+    foldr f z (Product x) = f x z+    foldr1 _              = getProduct+# if MIN_VERSION_base(4,6,0)+    foldl'                = coerce+    foldr'                = F.foldr+# endif+# if MIN_VERSION_base(4,8,0)+    elem                  = (. getProduct) #. (==)+    length _              = 1+    maximum               = getProduct+    minimum               = getProduct+    null _                = False+    product               = getProduct+    sum                   = getProduct+    toList (Product x)    = [x]+# endif++# if MIN_VERSION_base(4,8,0)+(#.)   :: Coercible b c => (b -> c) -> (a -> b) -> (a -> c)+(#.) _f = coerce+# endif++# if !(MIN_VERSION_base(4,7,0))+coerce ::                  a -> b+coerce = unsafeCoerce+# endif++instance Functor Dual where+    fmap     = coerce++instance Applicative Dual where+    pure     = Dual+    (<*>)    = coerce++instance Monad Dual where+    return   = Dual+    m >>= k  = k (getDual m)++instance Functor Sum where+    fmap     = coerce++instance Applicative Sum where+    pure     = Sum+    (<*>)    = coerce++instance Monad Sum where+    return   = Sum+    m >>= k  = k (getSum m)++instance Functor Product where+    fmap     = coerce++instance Applicative Product where+    pure     = Product+    (<*>)    = coerce++instance Monad Product where+    return   = Product+    m >>= k  = k (getProduct m)++instance F.Foldable First where+    foldMap f = F.foldMap f . getFirst++instance F.Foldable Last where+    foldMap f = F.foldMap f . getLast++instance Monoid a => Monoid (IO a) where+    mempty = pure mempty+    mappend = liftA2 mappend++-- see: #10190 https://git.haskell.org/ghc.git/commitdiff/9db005a444722e31aca1956b058e069bcf3cacbd+instance Monoid a => Monad ((,) a) where+    return x = (mempty, x)+    (u, a) >>= k = case k a of (v, b) -> (u `mappend` v, b)++instance MonadFix Dual where+    mfix f   = Dual (fix (getDual . f))++instance MonadFix Sum where+    mfix f   = Sum (fix (getSum . f))++instance MonadFix Product where+    mfix f   = Product (fix (getProduct . f))++instance MonadFix First where+    mfix f   = First (mfix (getFirst . f))++instance MonadFix Last where+    mfix f   = Last (mfix (getLast . f))++instance T.Traversable Dual where+    traverse f (Dual x) = Dual <$> f x++instance T.Traversable Sum where+    traverse f (Sum x) = Sum <$> f x++instance T.Traversable Product where+    traverse f (Product x) = Product <$> f x++instance T.Traversable First where+    traverse f (First x) = First <$> T.traverse f x++instance T.Traversable Last where+    traverse f (Last x) = Last <$> T.traverse f x++deriving instance F.Foldable    ZipList+deriving instance T.Traversable ZipList++# if MIN_VERSION_base(4,4,0)+deriving instance Functor     Complex+deriving instance F.Foldable    Complex+deriving instance T.Traversable Complex++instance Applicative Complex where+  pure a = a :+ a+  f :+ g <*> a :+ b = f a :+ g b++instance Monad Complex where+  return a = a :+ a+  a :+ b >>= f = realPart (f a) :+ imagPart (f b)++-- | Extracts the real part of a complex number.+realPart :: Complex a -> a+realPart (x :+ _) =  x++-- | Extracts the imaginary part of a complex number.+imagPart :: Complex a -> a+imagPart (_ :+ y) =  y++instance MonadZip Dual where+    -- Cannot use coerce, it's unsafe+    mzipWith = liftM2++instance MonadZip Sum where+    mzipWith = liftM2++instance MonadZip Product where+    mzipWith = liftM2++instance MonadZip Maybe where+    mzipWith = liftM2++instance MonadZip First where+    mzipWith = liftM2++instance MonadZip Last where+    mzipWith = liftM2+# endif++# if MIN_VERSION_base(4,8,0)+deriving instance (Data (f a), Typeable f, Typeable a)+    => Data (Alt (f :: * -> *) (a :: *))++instance MonadFix f => MonadFix (Alt f) where+    mfix f   = Alt (mfix (getAlt . f))++instance MonadZip f => MonadZip (Alt f) where+    mzipWith f (Alt ma) (Alt mb) = Alt (mzipWith f ma mb)++deriving instance Bounded a  => Bounded (Identity a)+deriving instance Enum a     => Enum (Identity a)+deriving instance Ix a       => Ix (Identity a)+deriving instance Monoid a   => Monoid (Identity a)+deriving instance Storable a => Storable (Identity a)+# endif #endif  #if __GLASGOW_HASKELL__ < 710
src/Data/Orphans/Prelude.hs view
@@ -10,7 +10,7 @@ Note that this module does not export any modules that could introduce name clashes. -} module Data.Orphans.Prelude-#if MIN_VERSION_base(4,8,0)+#if MIN_VERSION_base(4,9,0)     () where #else     (module OrphansPrelude) where@@ -98,6 +98,10 @@ import Text.Read.Lex as OrphansPrelude (Number) # else import Control.Concurrent.SampleVar as OrphansPrelude+# endif++# if MIN_VERSION_base(4,8,0)+import Data.Functor.Identity as OrphansPrelude # endif  #endif