packages feed

uniform-pair 0.1.12 → 0.1.13

raw patch · 2 files changed

+58/−8 lines, 2 filesdep +semigroupsdep +transformersdep +transformers-compatPVP ok

version bump matches the API change (PVP)

Dependencies added: semigroups, transformers, transformers-compat

API changes (from Hackage documentation)

+ Data.UniformPair: instance Data.Functor.Classes.Eq1 Data.UniformPair.Pair
+ Data.UniformPair: instance Data.Functor.Classes.Ord1 Data.UniformPair.Pair
+ Data.UniformPair: instance Data.Functor.Classes.Show1 Data.UniformPair.Pair
+ Data.UniformPair: instance Data.Semigroup.Semigroup a => Data.Semigroup.Semigroup (Data.UniformPair.Pair a)
+ Data.UniformPair: instance Prelude.Extras.Eq1 Data.UniformPair.Pair
+ Data.UniformPair: instance Prelude.Extras.Ord1 Data.UniformPair.Pair

Files

src/Data/UniformPair.hs view
@@ -1,6 +1,16 @@-{-# LANGUAGE DeriveFunctor, DeriveFoldable, DeriveTraversable #-}+{-# LANGUAGE CPP, DeriveFunctor, DeriveFoldable, DeriveTraversable #-} {-# OPTIONS_GHC -Wall #-}-+#if MIN_VERSION_base(4,9,0)+#define LIFTED_FUNCTOR_CLASSES 1+#else+#if MIN_VERSION_transformers(0,5,0)+#define LIFTED_FUNCTOR_CLASSES 1+#else+#if MIN_VERSION_transformers_compat(0,5,0) && !MIN_VERSION_transformers(0,4,0)+#define LIFTED_FUNCTOR_CLASSES 1+#endif+#endif+#endif ---------------------------------------------------------------------- -- | -- Module      :  Data.UniformPair@@ -24,14 +34,16 @@   ( Pair(..), fstP,sndP, firstP, secondP, getP, onElemP, swapP, compareSwap   ) where -import Data.Monoid (Monoid(..),(<>))+import Data.Monoid (Monoid(..))+import Data.Semigroup (Semigroup (..)) import Data.Functor ((<$>)) import Data.Foldable (Foldable(..)) import Data.Traversable (Traversable(..))+import Data.Functor.Classes (Eq1(..), Ord1(..), Show1(..)) import Control.Applicative (Applicative(..)) -- ,liftA2 import Control.DeepSeq (NFData(..)) -import Prelude.Extras (Show1(..))+import qualified Prelude.Extras as PE (Eq1, Ord1, Show1)  infix 1 :# @@ -43,8 +55,29 @@ instance NFData a => NFData (Pair a) where     rnf (a :# b) = rnf a `seq` rnf b -instance Show1 Pair+instance PE.Eq1 Pair+instance PE.Ord1 Pair+instance PE.Show1 Pair +#if LIFTED_FUNCTOR_CLASSES+instance Eq1 Pair where+  liftEq eq (a :# b) (c :# d) = eq a c && eq b d++instance Ord1 Pair where+  liftCompare cmp (a :# b) (c :# d) = cmp a c `mappend` cmp b d++instance Show1 Pair where+  liftShowsPrec sp _sl d (a :# b) = showParen (d > 1) $+    sp 2 a . showString " :# " . sp 2 b+#else+instance Eq1 Pair where+  eq1 = (==)+instance Ord1 Pair where+  compare1 = compare+instance Show1 Pair where+  showsPrec1 = showsPrec+#endif+ fstP :: Pair a -> a fstP (a :# _) = a @@ -59,9 +92,12 @@ -- unzipP ps = (fstP <$> ps) :# (sndP <$> ps) -- unzipP = liftA2 (:#) (fmap fstP) (fmap sndP) +instance Semigroup a => Semigroup (Pair a) where+  (a :# b) <> (c :# d) = (a <> c) :# (b <> d)+ instance Monoid a => Monoid (Pair a) where   mempty = mempty :# mempty-  (a :# b) `mappend` (c :# d) = (a <> c) :# (b <> d)  -- exchange+  (a :# b) `mappend` (c :# d) = (a `mappend` c) :# (b `mappend` d)  -- exchange  instance Applicative Pair where   pure a = a :# a
uniform-pair.cabal view
@@ -1,10 +1,14 @@ Name:                uniform-pair-Version:             0.1.12+Version:             0.1.13 Cabal-Version:       >= 1.6 Synopsis:            Uniform pairs with class instances Category:            Data Description:   Uniform pairs with class instances+  .+  @+  data Pair a = a :# a+  @ Author:              Conal Elliott Maintainer:          conal@conal.net Copyright:           (c) 2013 by Conal Elliott@@ -14,6 +18,14 @@ Stability:           experimental build-type:          Simple data-files:          changelog+tested-with:+  GHC==8.0.2,+  GHC==7.10.3,+  GHC==7.8.4,+  GHC==7.6.3,+  GHC==7.4.2,+  GHC==7.2.2,+  GHC==7.0.4  source-repository head   type:     git@@ -23,6 +35,8 @@   hs-Source-Dirs:      src   Extensions:   Build-Depends:       base<5, prelude-extras < 0.5, deepseq-  Exposed-Modules:     +  Exposed-Modules:                        Data.UniformPair   ghc-options:         -Wall+  if !impl(ghc >= 8.0)+    Build-Depends:     semigroups >= 0.18.2, transformers >= 0.2, transformers-compat >= 0.4