http-client 0.5.8 → 0.5.9
raw patch · 3 files changed
+30/−11 lines, 3 filesdep +semigroupsdep ~basedep ~blaze-builder
Dependencies added: semigroups
Dependency ranges changed: base, blaze-builder
Files
- ChangeLog.md +4/−0
- Network/HTTP/Client/Types.hs +19/−7
- http-client.cabal +7/−4
ChangeLog.md view
@@ -1,3 +1,7 @@+## 0.5.9++* Add `Semigroup` instances for GHC 8.4 [#320](https://github.com/snoyberg/http-client/pull/320)+ ## 0.5.8 * Switch to the new STM-based manager
Network/HTTP/Client/Types.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-}@@ -44,7 +45,8 @@ import Blaze.ByteString.Builder (Builder, fromLazyByteString, fromByteString, toLazyByteString) import Data.Int (Int64) import Data.Foldable (Foldable)-import Data.Monoid+import Data.Monoid (Monoid(..))+import Data.Semigroup (Semigroup(..)) import Data.String (IsString, fromString) import Data.Time (UTCTime) import Data.Traversable (Traversable)@@ -277,16 +279,21 @@ instance Eq CookieJar where (==) cj1 cj2 = (DL.sort $ expose cj1) == (DL.sort $ expose cj2) --- | Since 1.9-instance Data.Monoid.Monoid CookieJar where- mempty = CJ []- (CJ a) `mappend` (CJ b) = CJ (DL.nub $ DL.sortBy compare' $ a `mappend` b)+instance Semigroup CookieJar where+ (CJ a) <> (CJ b) = CJ (DL.nub $ DL.sortBy compare' $ a <> b) where compare' c1 c2 = -- inverse so that recent cookies are kept by nub over older if cookie_creation_time c1 > cookie_creation_time c2 then LT else GT +-- | Since 1.9+instance Data.Monoid.Monoid CookieJar where+ mempty = CJ []+#if !(MIN_VERSION_base(4,11,0))+ mappend = (<>)+#endif+ -- | Define a HTTP proxy, consisting of a hostname and port number. data Proxy = Proxy@@ -323,9 +330,14 @@ fromString str = RequestBodyBS (fromString str) instance Monoid RequestBody where mempty = RequestBodyBS S.empty- mappend x0 y0 =+#if !(MIN_VERSION_base(4,11,0))+ mappend = (<>)+#endif++instance Semigroup RequestBody where+ x0 <> y0 = case (simplify x0, simplify y0) of- (Left (i, x), Left (j, y)) -> RequestBodyBuilder (i + j) (x `mappend` y)+ (Left (i, x), Left (j, y)) -> RequestBodyBuilder (i + j) (x <> y) (Left x, Right y) -> combine (builderToStream x) y (Right x, Left y) -> combine x (builderToStream y) (Right x, Right y) -> combine x y
http-client.cabal view
@@ -1,5 +1,5 @@ name: http-client-version: 0.5.8+version: 0.5.9 synopsis: An HTTP client engine description: Hackage documentation generation is not reliable. For up to date documentation, please see: <http://www.stackage.org/package/http-client>. homepage: https://github.com/snoyberg/http-client@@ -37,7 +37,7 @@ Network.PublicSuffixList.Serialize Network.PublicSuffixList.DataStructure Data.KeyedPool- build-depends: base >= 4.5 && < 5+ build-depends: base >= 4.6 && < 5 , bytestring >= 0.10 , text >= 0.11 , http-types >= 0.8@@ -45,7 +45,7 @@ , time >= 1.2 , network >= 2.4 , streaming-commons >= 0.1.0.2 && < 0.3- , containers+ , containers >= 0.5 , transformers , deepseq >= 1.3 && <1.5 , case-insensitive >= 1.0@@ -57,11 +57,14 @@ , filepath , mime-types , ghc-prim- , stm+ , stm >= 2.3 if flag(network-uri) build-depends: network >= 2.6, network-uri >= 2.6 else build-depends: network < 2.6++ if !impl(ghc>=8.0)+ build-depends: semigroups >= 0.16.1 if os(mingw32) build-depends: Win32, safe