packages feed

pipes-s3 0.3.0.3 → 0.3.1

raw patch · 2 files changed

+16/−11 lines, 2 filesdep +semigroupsdep ~http-typesdep ~pipes-safe

Dependencies added: semigroups

Dependency ranges changed: http-types, pipes-safe

Files

pipes-s3.cabal view
@@ -1,5 +1,5 @@ name:                pipes-s3-version:             0.3.0.3+version:             0.3.1 synopsis:            A simple interface for streaming data to and from Amazon S3 description:     This package provides a simple interface for streaming data to and from@@ -13,7 +13,7 @@ category:            Network build-type:          Simple cabal-version:       >=1.10-tested-with:         GHC ==7.8.4, GHC ==7.10.3, GHC ==8.0.1+tested-with:         GHC ==7.10.3, GHC ==8.0.1, GHC ==8.2.2, GHC ==8.4.3, GHC==8.6.1  source-repository head   type:      git@@ -29,18 +29,19 @@   hs-source-dirs:      src   default-language:    Haskell2010   ghc-options:         -Wall-  build-depends:       base             >=4.7  && <4.11,+  build-depends:       base             >=4.7  && <4.13,                        transformers     >=0.4  && <0.6,                        bytestring       >=0.10 && <0.11,                        text             >=1.2  && <1.3,                        pipes-bytestring >=2.1  && <2.2,-                       pipes-safe       >=2.2  && <2.3,+                       pipes-safe       >=2.2  && <2.4,                        pipes            >=4.1  && <4.4,-                       http-types       >=0.9  && <0.10,+                       http-types       >=0.9  && <0.13,                        http-client      >=0.4  && <0.6,                        http-client-tls  >=0.2  && <0.4,-                       resourcet        >=1.1  && <1.2,-                       aws              >=0.13 && <0.17+                       resourcet        >=1.1  && <1.3,+                       semigroups       >=0.18 && <0.19,+                       aws              >=0.13 && <0.21  test-suite pipes-s3-tests   type:                exitcode-stdio-1.0
src/Pipes/Aws/S3/Download/Retry.hs view
@@ -15,6 +15,7 @@     ) where  import Control.Monad (when)+import Data.Semigroup import Data.IORef import System.IO @@ -30,14 +31,17 @@ -- | How many times to attempt an object download before giving up. data RetryPolicy m = forall s. RetryIf s (Bucket -> Object -> s -> SomeException -> m (s, Bool)) +instance Applicative m => Semigroup (RetryPolicy m) where+    RetryIf sx0 px <> RetryIf sy0 py =+        RetryIf (sx0, sy0) (\bucket object (sx, sy) exc -> merge <$> px bucket object sx exc <*> py bucket object sy exc)+      where+        merge (sx1, againX) (sy1, againY) = ((sx1, sy1), againX && againY)+ -- | @mempty@ will always retry. @mappend@ will retry only if both -- 'RetryPolicy's say to retry. instance Applicative m => Monoid (RetryPolicy m) where     mempty = RetryIf () (\_ _ s _ -> pure (s, True))-    RetryIf sx0 px `mappend` RetryIf sy0 py =-        RetryIf (sx0, sy0) (\bucket object (sx, sy) exc -> merge <$> px bucket object sx exc <*> py bucket object sy exc)-      where-        merge (sx1, againX) (sy1, againY) = ((sx1, sy1), againX && againY)+    mappend = (<>)  -- | Retry a download no more than @n@ times. retryNTimes :: Applicative m => Int -> RetryPolicy m