packages feed

these 1.1.1.1 → 1.2

raw patch · 5 files changed

+141/−38 lines, 5 filesdep +bifunctor-classes-compatdep +foldable1-classes-compatdep −bifunctorsdep ~assocdep ~basedep ~deepseq

Dependencies added: bifunctor-classes-compat, foldable1-classes-compat

Dependencies removed: bifunctors

Dependency ranges changed: assoc, base, deepseq

Files

CHANGELOG.md view
@@ -1,3 +1,17 @@+# 1.2++- Depend on `bifunctor-classes-compat` instead of `bifunctors`+  See changelog note in `bifunctors-5.6`: https://hackage.haskell.org/package/bifunctors-5.6/changelog+  This is breaking change, but affects only GHC-8.0 and older users.+  In that case you should check various combinations of newer/older+  `bifunctors`, `these` (and e.g. `semialign`) packages.+- Depend on `assoc-1.1`. Since version 1.1 `assoc` has an almost trivial+  dependency footprint, so `these` depends on it unconditionally.+- Add `Bifoldable1 These` instance+- Add `Foldable1 (Data.Functor.These1 f g)` instance+- Change `Eq (These1 f g a)`, `Ord`, `Read`, `Show`, `NFData` instances similarly to how+  they are changed for `Product` and `Sum` in `base-4.18.0.0`.+ # 1.1.1.1  - Workaround GCC-4 C-preprocessor bug
src/Data/Functor/These.hs view
@@ -4,6 +4,7 @@ {-# LANGUAGE DeriveFunctor      #-} {-# LANGUAGE DeriveGeneric      #-} {-# LANGUAGE DeriveTraversable  #-}+{-# LANGUAGE FlexibleContexts   #-} {-# LANGUAGE OverloadedStrings  #-} {-# LANGUAGE Safe               #-} @@ -23,10 +24,9 @@     ) where  import Data.Foldable        (Foldable)-import Data.Functor.Classes-       (Eq1 (..), Ord1 (..), Read1 (..), Show1 (..), compare1, eq1, readsPrec1,-       showsPrec1)+import Data.Functor.Classes (Eq1 (..), Ord1 (..), Read1 (..), Show1 (..)) import Data.Monoid          (Monoid (..))+import Data.Semigroup       (Semigroup (..)) import Data.Traversable     (Traversable) import GHC.Generics         (Generic) import Prelude@@ -34,9 +34,13 @@        Show (..), lex, readParen, return, seq, showChar, showParen, showString,        ($), (&&), (.)) +import qualified Data.Foldable  as F+import qualified Data.Foldable1 as F1  #if MIN_VERSION_deepseq(1,4,3)-import Control.DeepSeq (NFData (..), NFData1 (..), rnf1)+import Control.DeepSeq (NFData (..), NFData1 (..))+#else+import Control.DeepSeq (NFData (..)) #endif  #if __GLASGOW_HASKELL__ >= 706@@ -190,11 +194,56 @@ -- Eq, Ord, Show, Read ------------------------------------------------------------------------------- -instance (Eq1 f, Eq1 g, Eq a) => Eq (These1 f g a) where (==) = eq1-instance (Ord1 f, Ord1 g, Ord a) => Ord (These1 f g a) where compare = compare1-instance (Show1 f, Show1 g, Show a) => Show (These1 f g a) where showsPrec = showsPrec1-instance (Read1 f, Read1 g, Read a) => Read (These1 f g a) where readsPrec = readsPrec1+instance (Eq   (f a), Eq   (g a), Eq a)   => Eq (These1 f g a) where+    This1 f    == This1 f'     = f == f'+    That1 g    == That1 g'     = g == g'+    These1 f g == These1 f' g' = f == f' && g == g' +    This1  {} == _ = False+    That1  {} == _ = False+    These1 {} == _ = False++instance (Ord  (f a), Ord  (g a), Ord a)  => Ord (These1 f g a) where+    compare (This1 f) (This1 f') = compare f f'+    compare (This1 _) _          = LT+    compare _         (This1 _)  = GT++    compare (That1 g) (That1 g') = compare g g'+    compare (That1 _) _          = LT+    compare _         (That1 _)  = GT++    compare  (These1 f g) (These1 f' g') =+        compare f f' `mappend` compare g g'++instance (Show (f a), Show (g a), Show a) => Show (These1 f g a) where+    showsPrec d (This1 f) = showParen (d > 10)+        $ showString "This1 "+        . showsPrec 11 f+    showsPrec d (That1 g) = showParen (d > 10)+        $ showString "That1 "+        . showsPrec 11 g+    showsPrec d (These1 f g) = showParen (d > 10)+        $ showString "These1 "+        . showsPrec 11 f+        . showChar ' '+        . showsPrec 11 g++instance (Read (f a), Read (g a), Read a) => Read (These1 f g a) where+    readsPrec d = readParen (d > 10) $ \s0 -> do+        (t, s1) <- lex s0+        case t of+            "This1" -> do+                (x, s2) <- readsPrec 11 s1+                return (This1 x, s2)+            "That1" -> do+                (y, s2) <- readsPrec 11 s1+                return (That1 y, s2)+            "These1" -> do+                (x, s2) <- readsPrec 11 s1+                (y, s3) <- readsPrec 11 s2+                return (These1 x y, s3)+            _ -> []+ ------------------------------------------------------------------------------- -- deepseq -------------------------------------------------------------------------------@@ -205,8 +254,34 @@     liftRnf r (This1 x)    = liftRnf r x     liftRnf r (That1 y)    = liftRnf r y     liftRnf r (These1 x y) = liftRnf r x `seq` liftRnf r y---- | This instance is available only with @deepseq >= 1.4.3.0@-instance (NFData1 f, NFData1 g, NFData a) => NFData (These1 f g a) where-    rnf = rnf1 #endif++-- | Available always+--+-- @since 1.2+instance (NFData (f a), NFData (g a), NFData a) => NFData (These1 f g a) where+    rnf (This1 x)    = rnf x+    rnf (That1 y)    = rnf y+    rnf (These1 x y) = rnf x `seq` rnf y++-------------------------------------------------------------------------------+-- foldable1+-------------------------------------------------------------------------------++-- | @since 1.2+instance (F1.Foldable1 f, F1.Foldable1 g) => F1.Foldable1 (These1 f g) where+    foldMap1 f (This1 x)    = F1.foldMap1 f x+    foldMap1 f (That1 y)    = F1.foldMap1 f y+    foldMap1 f (These1 x y) = F1.foldMap1 f x <> F1.foldMap1 f y++    foldrMap1 f g (This1 x)    = F1.foldrMap1 f g x+    foldrMap1 f g (That1 y)    = F1.foldrMap1 f g y+    foldrMap1 f g (These1 x y) = F.foldr g (F1.foldrMap1 f g y) x++    head (This1 x)    = F1.head x+    head (That1 y)    = F1.head y+    head (These1 x _) = F1.head x++    last (This1 x)    = F1.last x+    last (That1 y)    = F1.last y+    last (These1 _ y) = F1.last y
src/Data/These.hs view
@@ -33,7 +33,7 @@      -- * Distributivity     ---    -- | This distributivity combinators aren't isomorphisms!+    -- | These distributivity combinators aren't isomorphisms!     , distrThesePair     , undistrThesePair     , distrPairThese@@ -43,6 +43,7 @@ import Control.Applicative  (Applicative (..), (<$>)) import Control.DeepSeq      (NFData (..)) import Data.Bifoldable      (Bifoldable (..))+import Data.Bifoldable1     (Bifoldable1 (..)) import Data.Bifunctor       (Bifunctor (..)) import Data.Binary          (Binary (..)) import Data.Bitraversable   (Bitraversable (..))@@ -84,6 +85,8 @@  -- $setup -- >>> import Control.Lens+-- >>> import Data.List.NonEmpty (NonEmpty (..))+-- >>> import Prelude (Either (..), map, ($))  -- -------------------------------------------------------------------------- -- | The 'These' type represents values with two non-exclusive possibilities.@@ -216,8 +219,6 @@ -- Instances ------------------------------------------------------------------------------- -- instance (Semigroup a, Semigroup b) => Semigroup (These a b) where     This  a   <> This  b   = This  (a <> b)     This  a   <> That    y = These  a             y@@ -254,9 +255,15 @@  instance Bifoldable These where     bifold = these id id mappend+    bifoldMap f g = these f g (\x y -> mappend (f x) (g y))     bifoldr f g z = these (`f` z) (`g` z) (\x y -> x `f` (y `g` z))     bifoldl f g z = these (z `f`) (z `g`) (\x y -> (z `f` x) `g` y) +-- | @since 1.2+instance Bifoldable1 These where+    bifold1 = these id id (<>)+    bifoldMap1 f g = these f g (\x y -> f x <> g y)+ instance Bitraversable These where     bitraverse f _ (This x) = This <$> f x     bitraverse _ g (That x) = That <$> g x@@ -368,7 +375,6 @@ -- assoc ------------------------------------------------------------------------------- -#ifdef MIN_VERSION_assoc -- | @since 0.8 instance Swap These where     swap (This a)    = That a@@ -392,7 +398,6 @@     unassoc (These a (This b))    = This (These a b)     unassoc (These a (That c))    = These (This a) c     unassoc (These a (These b c)) = These (These a b) c-#endif  ------------------------------------------------------------------------------- -- deepseq
src/Data/These/Combinators.hs view
@@ -92,6 +92,9 @@ import Data.Bifunctor.Swap  (swap) #endif +-- $setup+-- >>> import Data.These+ ------------------------------------------------------------------------------- -- bifunctors -------------------------------------------------------------------------------
these.cabal view
@@ -1,8 +1,8 @@ cabal-version:      >=1.10 name:               these-version:            1.1.1.1+version:            1.2 synopsis:           An either-or-both data type.-homepage:           https://github.com/isomorphism/these+homepage:           https://github.com/haskellari/these license:            BSD3 license-file:       LICENSE author:             C. McCann, Oleg Grenrus@@ -39,27 +39,27 @@      || ==8.2.2      || ==8.4.4      || ==8.6.5-     || ==8.8.3-     || ==8.10.1+     || ==8.8.4+     || ==8.10.7+     || ==9.0.2+     || ==9.2.7+     || ==9.4.4+     || ==9.6.1   , GHCJS ==8.4  source-repository head   type:     git-  location: https://github.com/isomorphism/these.git--flag assoc-  description: Build with assoc dependency-  manual:      True-  default:     True+  location: https://github.com/haskellari/these.git+  subdir:   these  library-  default-language: Haskell2010-  ghc-options:      -Wall+  default-language:         Haskell2010+  ghc-options:              -Wall    if impl(ghc >=8.0)     ghc-options: -Wno-trustworthy-safe -  hs-source-dirs:   src+  hs-source-dirs:           src   exposed-modules:     Data.Functor.These     Data.These@@ -67,28 +67,34 @@    -- ghc boot libs   build-depends:-      base     >=4.5.1.0 && <4.15+      base     >=4.5.1.0 && <4.19     , binary   >=0.5.1.0 && <0.10     , deepseq  >=1.3.0.0 && <1.5    -- other dependencies-  build-depends:    hashable >=1.2.7.0 && <1.4+  -- note: we need to depend on assoc-1.1 to be sure that+  -- Bifunctor type class comes from bifunctor-classes-compat+  build-depends:+      assoc     >=1.1     && <1.2+    , hashable  >=1.2.7.0 && <1.5    if impl(ghc <7.5)     build-depends: ghc-prim +  if !impl(ghc >=9.6)+    build-depends: foldable1-classes-compat >=0.1 && <0.2+   if !impl(ghc >=8.2)-    build-depends: bifunctors >=5.5.4 && <5.6+    build-depends: bifunctor-classes-compat >=0.1 && <0.2    if !impl(ghc >=8.0)     build-depends:-        semigroups           >=0.18.5  && <0.20-      , transformers         >=0.3.0.0 && <0.6-      , transformers-compat  >=0.6.5   && <0.7+        semigroups           >=0.18.5  && <0.21+      , transformers         >=0.3.0.0 && <0.7+      , transformers-compat  >=0.6.5   && <0.8      -- Ensure Data.Functor.Classes is always available     if impl(ghc >=7.10)       build-depends: transformers >=0.4.2.0 -  if flag(assoc)-    build-depends: assoc >=1 && <1.1+  x-docspec-extra-packages: lens