Merge pull request #1076 from phadej/run-streaming-client

Add runClientM for streaming-client
This commit is contained in:
Oleg Grenrus 2018-11-09 21:13:05 +02:00 committed by GitHub
commit bbf196717f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 206 additions and 156 deletions

View file

@ -71,7 +71,7 @@ install:
- grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$' - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
- "printf 'packages: \"servant\" \"servant-client\" \"servant-client-core\" \"servant-docs\" \"servant-foreign\" \"servant-server\" \"doc/tutorial\" \"servant-machines\" \"servant-conduit\" \"servant-pipes\" \"doc/cookbook/basic-auth\" \"doc/cookbook/curl-mock\" \"doc/cookbook/basic-streaming\" \"doc/cookbook/db-postgres-pool\" \"doc/cookbook/db-sqlite-simple\" \"doc/cookbook/file-upload\" \"doc/cookbook/generic\" \"doc/cookbook/hoist-server-with-context\" \"doc/cookbook/https\" \"doc/cookbook/jwt-and-basic-auth\" \"doc/cookbook/sentry\" \"doc/cookbook/testing\" \"doc/cookbook/structuring-apis\" \"doc/cookbook/using-custom-monad\" \"doc/cookbook/using-free-client\"\\n' > cabal.project" - "printf 'packages: \"servant\" \"servant-client\" \"servant-client-core\" \"servant-docs\" \"servant-foreign\" \"servant-server\" \"doc/tutorial\" \"servant-machines\" \"servant-conduit\" \"servant-pipes\" \"doc/cookbook/basic-auth\" \"doc/cookbook/curl-mock\" \"doc/cookbook/basic-streaming\" \"doc/cookbook/db-postgres-pool\" \"doc/cookbook/db-sqlite-simple\" \"doc/cookbook/file-upload\" \"doc/cookbook/generic\" \"doc/cookbook/hoist-server-with-context\" \"doc/cookbook/https\" \"doc/cookbook/jwt-and-basic-auth\" \"doc/cookbook/sentry\" \"doc/cookbook/testing\" \"doc/cookbook/structuring-apis\" \"doc/cookbook/using-custom-monad\" \"doc/cookbook/using-free-client\"\\n' > cabal.project"
- "echo 'constraints: foundation >=0.0.14,memory <0.14.12 || >0.14.12' >> cabal.project" - "echo 'constraints: foundation >=0.0.14,memory <0.14.12 || >0.14.12' >> cabal.project"
- "echo 'allow-newer: servant-js:base, servant-pagination:servant,servant-pagination:servant-server' >> cabal.project" - "echo 'allow-newer: servant-js:base, servant-pagination:servant, servant-pagination:servant-server,servant-multipart:servant, servant-multipart:servant-server,servant-quickcheck:servant, servant-quickcheck:servant-client, servant-quickcheck:servant-server,servant-auth-server:servant, servant-auth-server:servant-server,servant-js:servant, servant-js:servant-foreign,servant-quickcheck:hspec' >> cabal.project"
- touch cabal.project.local - touch cabal.project.local
- "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- servant | grep -vw -- servant-client | grep -vw -- servant-client-core | grep -vw -- servant-docs | grep -vw -- servant-foreign | grep -vw -- servant-server | grep -vw -- tutorial | grep -vw -- servant-machines | grep -vw -- servant-conduit | grep -vw -- servant-pipes | grep -vw -- cookbook-basic-auth | grep -vw -- cookbook-curl-mock | grep -vw -- cookbook-basic-streaming | grep -vw -- cookbook-db-postgres-pool | grep -vw -- cookbook-db-sqlite-simple | grep -vw -- cookbook-file-upload | grep -vw -- cookbook-generic | grep -vw -- cookbook-hoist-server-with-context | grep -vw -- cookbook-https | grep -vw -- cookbook-jwt-and-basic-auth | grep -vw -- cookbook-sentry | grep -vw -- cookbook-testing | grep -vw -- cookbook-structuring-apis | grep -vw -- cookbook-using-custom-monad | grep -vw -- cookbook-using-free-client | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi" - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- servant | grep -vw -- servant-client | grep -vw -- servant-client-core | grep -vw -- servant-docs | grep -vw -- servant-foreign | grep -vw -- servant-server | grep -vw -- tutorial | grep -vw -- servant-machines | grep -vw -- servant-conduit | grep -vw -- servant-pipes | grep -vw -- cookbook-basic-auth | grep -vw -- cookbook-curl-mock | grep -vw -- cookbook-basic-streaming | grep -vw -- cookbook-db-postgres-pool | grep -vw -- cookbook-db-sqlite-simple | grep -vw -- cookbook-file-upload | grep -vw -- cookbook-generic | grep -vw -- cookbook-hoist-server-with-context | grep -vw -- cookbook-https | grep -vw -- cookbook-jwt-and-basic-auth | grep -vw -- cookbook-sentry | grep -vw -- cookbook-testing | grep -vw -- cookbook-structuring-apis | grep -vw -- cookbook-using-custom-monad | grep -vw -- cookbook-using-free-client | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"
- cat cabal.project || true - cat cabal.project || true
@ -168,7 +168,7 @@ script:
- find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \; - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
- "printf 'packages: servant-*/*.cabal servant-client-*/*.cabal servant-client-core-*/*.cabal servant-docs-*/*.cabal servant-foreign-*/*.cabal servant-server-*/*.cabal tutorial-*/*.cabal servant-machines-*/*.cabal servant-conduit-*/*.cabal servant-pipes-*/*.cabal cookbook-basic-auth-*/*.cabal cookbook-curl-mock-*/*.cabal cookbook-basic-streaming-*/*.cabal cookbook-db-postgres-pool-*/*.cabal cookbook-db-sqlite-simple-*/*.cabal cookbook-file-upload-*/*.cabal cookbook-generic-*/*.cabal cookbook-hoist-server-with-context-*/*.cabal cookbook-https-*/*.cabal cookbook-jwt-and-basic-auth-*/*.cabal cookbook-sentry-*/*.cabal cookbook-testing-*/*.cabal cookbook-structuring-apis-*/*.cabal cookbook-using-custom-monad-*/*.cabal cookbook-using-free-client-*/*.cabal\\n' > cabal.project" - "printf 'packages: servant-*/*.cabal servant-client-*/*.cabal servant-client-core-*/*.cabal servant-docs-*/*.cabal servant-foreign-*/*.cabal servant-server-*/*.cabal tutorial-*/*.cabal servant-machines-*/*.cabal servant-conduit-*/*.cabal servant-pipes-*/*.cabal cookbook-basic-auth-*/*.cabal cookbook-curl-mock-*/*.cabal cookbook-basic-streaming-*/*.cabal cookbook-db-postgres-pool-*/*.cabal cookbook-db-sqlite-simple-*/*.cabal cookbook-file-upload-*/*.cabal cookbook-generic-*/*.cabal cookbook-hoist-server-with-context-*/*.cabal cookbook-https-*/*.cabal cookbook-jwt-and-basic-auth-*/*.cabal cookbook-sentry-*/*.cabal cookbook-testing-*/*.cabal cookbook-structuring-apis-*/*.cabal cookbook-using-custom-monad-*/*.cabal cookbook-using-free-client-*/*.cabal\\n' > cabal.project"
- "echo 'constraints: foundation >=0.0.14,memory <0.14.12 || >0.14.12' >> cabal.project" - "echo 'constraints: foundation >=0.0.14,memory <0.14.12 || >0.14.12' >> cabal.project"
- "echo 'allow-newer: servant-js:base, servant-pagination:servant,servant-pagination:servant-server' >> cabal.project" - "echo 'allow-newer: servant-js:base, servant-pagination:servant, servant-pagination:servant-server,servant-multipart:servant, servant-multipart:servant-server,servant-quickcheck:servant, servant-quickcheck:servant-client, servant-quickcheck:servant-server,servant-auth-server:servant, servant-auth-server:servant-server,servant-js:servant, servant-js:servant-foreign,servant-quickcheck:hspec' >> cabal.project"
- touch cabal.project.local - touch cabal.project.local
- "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- servant | grep -vw -- servant-client | grep -vw -- servant-client-core | grep -vw -- servant-docs | grep -vw -- servant-foreign | grep -vw -- servant-server | grep -vw -- tutorial | grep -vw -- servant-machines | grep -vw -- servant-conduit | grep -vw -- servant-pipes | grep -vw -- cookbook-basic-auth | grep -vw -- cookbook-curl-mock | grep -vw -- cookbook-basic-streaming | grep -vw -- cookbook-db-postgres-pool | grep -vw -- cookbook-db-sqlite-simple | grep -vw -- cookbook-file-upload | grep -vw -- cookbook-generic | grep -vw -- cookbook-hoist-server-with-context | grep -vw -- cookbook-https | grep -vw -- cookbook-jwt-and-basic-auth | grep -vw -- cookbook-sentry | grep -vw -- cookbook-testing | grep -vw -- cookbook-structuring-apis | grep -vw -- cookbook-using-custom-monad | grep -vw -- cookbook-using-free-client | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi" - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- servant | grep -vw -- servant-client | grep -vw -- servant-client-core | grep -vw -- servant-docs | grep -vw -- servant-foreign | grep -vw -- servant-server | grep -vw -- tutorial | grep -vw -- servant-machines | grep -vw -- servant-conduit | grep -vw -- servant-pipes | grep -vw -- cookbook-basic-auth | grep -vw -- cookbook-curl-mock | grep -vw -- cookbook-basic-streaming | grep -vw -- cookbook-db-postgres-pool | grep -vw -- cookbook-db-sqlite-simple | grep -vw -- cookbook-file-upload | grep -vw -- cookbook-generic | grep -vw -- cookbook-hoist-server-with-context | grep -vw -- cookbook-https | grep -vw -- cookbook-jwt-and-basic-auth | grep -vw -- cookbook-sentry | grep -vw -- cookbook-testing | grep -vw -- cookbook-structuring-apis | grep -vw -- cookbook-using-custom-monad | grep -vw -- cookbook-using-free-client | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"
- cat cabal.project || true - cat cabal.project || true

View file

@ -38,5 +38,9 @@ constraints:
memory <0.14.12 || >0.14.12 memory <0.14.12 || >0.14.12
allow-newer: allow-newer:
servant-pagination:servant, servant-pagination:servant, servant-pagination:servant-server,
servant-pagination:servant-server servant-multipart:servant, servant-multipart:servant-server,
servant-quickcheck:servant, servant-quickcheck:servant-client, servant-quickcheck:servant-server,
servant-auth-server:servant, servant-auth-server:servant-server,
servant-js:servant, servant-js:servant-foreign,
servant-quickcheck:hspec

View file

@ -22,7 +22,7 @@ Language extensions and imports:
{-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeOperators #-}
import Control.Lens ((^.)) import Control.Lens ((^.))
import Data.Aeson.Compat import Data.Aeson
import Data.Aeson.Text import Data.Aeson.Text
import Data.Monoid ((<>)) import Data.Monoid ((<>))
import Data.Proxy (Proxy (Proxy)) import Data.Proxy (Proxy (Proxy))

View file

@ -14,7 +14,6 @@ executable cookbock-curl-mock
main-is: CurlMock.lhs main-is: CurlMock.lhs
build-depends: base == 4.* build-depends: base == 4.*
, aeson , aeson
, aeson-compat
, lens , lens
, text , text
, servant , servant

View file

@ -29,7 +29,7 @@ import Prelude.Compat
import Control.Monad.Except import Control.Monad.Except
import Control.Monad.Reader import Control.Monad.Reader
import Data.Aeson.Compat import Data.Aeson
import Data.Aeson.Types import Data.Aeson.Types
import Data.Attoparsec.ByteString import Data.Attoparsec.ByteString
import Data.ByteString (ByteString) import Data.ByteString (ByteString)

View file

@ -36,7 +36,6 @@ library
build-depends: build-depends:
base >= 4.7 && <4.13 base >= 4.7 && <4.13
, aeson , aeson
, aeson-compat
, attoparsec , attoparsec
, base-compat , base-compat
, bytestring , bytestring
@ -67,11 +66,10 @@ library
, blaze-markup >= 0.8.0.0 && < 0.9 , blaze-markup >= 0.8.0.0 && < 0.9
, cookie >= 0.4.3 && < 0.5 , cookie >= 0.4.3 && < 0.5
, js-jquery >= 3.2.1 && < 3.3 , js-jquery >= 3.2.1 && < 3.3
, lucid >= 2.9.9 && < 2.10 , lucid >= 2.9.11 && < 2.10
, mtl-compat >= 0.2.1 && < 0.3
, random >= 1.1 && < 1.2 , random >= 1.1 && < 1.2
, servant-js >= 0.9 && < 0.10 , servant-js >= 0.9 && < 0.10
, time >= 1.4.2 && < 1.9 , time >= 1.6.0.1 && < 1.9
-- For legacy tools, we need to specify build-depends too -- For legacy tools, we need to specify build-depends too
build-depends: markdown-unlit >= 0.5.0 && <0.6 build-depends: markdown-unlit >= 0.5.0 && <0.6

View file

@ -1,5 +1,5 @@
name: servant-client-core name: servant-client-core
version: 0.14.1 version: 0.15
synopsis: Core functionality and class for client function generation for servant APIs synopsis: Core functionality and class for client function generation for servant APIs
description: description:
This library provides backend-agnostic generation of client functions. For This library provides backend-agnostic generation of client functions. For
@ -50,26 +50,27 @@ library
base >= 4.9 && < 4.13 base >= 4.9 && < 4.13
, bytestring >= 0.10.8.1 && < 0.11 , bytestring >= 0.10.8.1 && < 0.11
, containers >= 0.5.7.1 && < 0.7 , containers >= 0.5.7.1 && < 0.7
, deepseq >= 1.4.2.0 && < 1.5
, text >= 1.2.3.0 && < 1.3 , text >= 1.2.3.0 && < 1.3
, transformers >= 0.5.2.0 && < 0.6 , transformers >= 0.5.2.0 && < 0.6
, template-haskell >= 2.11.1.0 && < 2.15 , template-haskell >= 2.11.1.0 && < 2.15
-- Servant dependencies -- Servant dependencies
build-depends: build-depends:
servant >= 0.14.1 && <0.15 servant >= 0.15 && <0.16
-- Other dependencies: Lower bound around what is in the latest Stackage LTS. -- Other dependencies: Lower bound around what is in the latest Stackage LTS.
-- Here can be exceptions if we really need features from the newer versions. -- Here can be exceptions if we really need features from the newer versions.
build-depends: build-depends:
aeson >= 1.4.0.0 && < 1.5 aeson >= 1.4.1.0 && < 1.5
, base-compat >= 0.10.1 && < 0.11 , base-compat >= 0.10.5 && < 0.11
, base64-bytestring >= 1.0.0.1 && < 1.1 , base64-bytestring >= 1.0.0.1 && < 1.1
, exceptions >= 0.10.0 && < 0.11 , exceptions >= 0.10.0 && < 0.11
, free >= 5.0.2 && < 5.2 , free >= 5.1 && < 5.2
, generics-sop >= 0.4.0.1 && < 0.5 , generics-sop >= 0.4.0.1 && < 0.5
, http-api-data >= 0.3.8.1 && < 0.4 , http-api-data >= 0.3.10 && < 0.4
, http-media >= 0.7.1.2 && < 0.8 , http-media >= 0.7.1.3 && < 0.8
, http-types >= 0.12.1 && < 0.13 , http-types >= 0.12.2 && < 0.13
, network-uri >= 2.6.1.0 && < 2.7 , network-uri >= 2.6.1.0 && < 2.7
, safe >= 0.3.17 && < 0.4 , safe >= 0.3.17 && < 0.4
@ -94,9 +95,9 @@ test-suite spec
-- Additonal dependencies -- Additonal dependencies
build-depends: build-depends:
deepseq >= 1.3.0.2 && < 1.5 deepseq >= 1.4.2.0 && < 1.5
, hspec >= 2.4.1 && < 2.6 , hspec >= 2.6.0 && < 2.7
, QuickCheck >= 2.12.6.1 && < 2.13 , QuickCheck >= 2.12.6.1 && < 2.13
build-tool-depends: build-tool-depends:
hspec-discover:hspec-discover >= 2.5.1 && <2.6 hspec-discover:hspec-discover >= 2.6.0 && <2.7

View file

@ -15,6 +15,8 @@ module Servant.Client.Core.Internal.Request where
import Prelude () import Prelude ()
import Prelude.Compat import Prelude.Compat
import Control.DeepSeq
(NFData (..))
import Control.Monad.Catch import Control.Monad.Catch
(Exception) (Exception)
import qualified Data.ByteString as BS import qualified Data.ByteString as BS
@ -34,10 +36,10 @@ import Data.Typeable
import GHC.Generics import GHC.Generics
(Generic) (Generic)
import Network.HTTP.Media import Network.HTTP.Media
(MediaType) (MediaType, mainType, parameters, subType)
import Network.HTTP.Types import Network.HTTP.Types
(Header, HeaderName, HttpVersion, Method, QueryItem, Status, (Header, HeaderName, HttpVersion (..), Method, QueryItem,
http11, methodGet) Status (..), http11, methodGet)
import Web.HttpApiData import Web.HttpApiData
(ToHttpApiData, toEncodedUrlPiece, toHeader) (ToHttpApiData, toEncodedUrlPiece, toHeader)
@ -59,6 +61,20 @@ data ServantError =
instance Exception ServantError instance Exception ServantError
instance NFData ServantError where
rnf (FailureResponse res) = rnf res
rnf (DecodeFailure err res) = rnf err `seq` rnf res
rnf (UnsupportedContentType mt' res) =
mediaTypeRnf mt' `seq`
rnf res
where
mediaTypeRnf mt =
rnf (mainType mt) `seq`
rnf (subType mt) `seq`
rnf (parameters mt)
rnf (InvalidContentTypeHeader res) = rnf res
rnf (ConnectionError err) = rnf err
data RequestF a = Request data RequestF a = Request
{ requestPath :: a { requestPath :: a
, requestQueryString :: Seq.Seq QueryItem , requestQueryString :: Seq.Seq QueryItem
@ -88,6 +104,16 @@ data GenResponse a = Response
, responseBody :: a , responseBody :: a
} deriving (Eq, Show, Generic, Typeable, Functor, Foldable, Traversable) } deriving (Eq, Show, Generic, Typeable, Functor, Foldable, Traversable)
instance NFData a => NFData (GenResponse a) where
rnf (Response sc hs hv body) =
rnfStatus sc `seq`
rnf hs `seq`
rnfHttpVersion hv `seq`
rnf body
where
rnfStatus (Status code msg) = rnf code `seq` rnf msg
rnfHttpVersion (HttpVersion _ _) = () -- HttpVersion fields are strict
type Response = GenResponse LBS.ByteString type Response = GenResponse LBS.ByteString
type StreamingResponse = GenResponse (IO BS.ByteString) type StreamingResponse = GenResponse (IO BS.ByteString)

View file

@ -41,12 +41,17 @@ library
, http-media >= 0.6.2 && < 0.8 , http-media >= 0.6.2 && < 0.8
, http-types >= 0.12 && < 0.13 , http-types >= 0.12 && < 0.13
, monad-control >= 1.0.0.4 && < 1.1 , monad-control >= 1.0.0.4 && < 1.1
, mtl >= 2.1 && < 2.3 , mtl >= 2.2.2 && < 2.3
, semigroupoids >= 4.3 && < 5.3 , semigroupoids >= 4.3 && < 5.3
, servant-client-core == 0.14.*
, string-conversions >= 0.3 && < 0.5 , string-conversions >= 0.3 && < 0.5
, transformers >= 0.3 && < 0.6 , transformers >= 0.3 && < 0.6
, transformers-base >= 0.4.4 && < 0.5 , transformers-base >= 0.4.4 && < 0.5
-- strict, as we re-export stuff
build-depends:
servant-client-core == 0.15
hs-source-dirs: src hs-source-dirs: src
default-language: Haskell2010 default-language: Haskell2010
ghc-options: -Wall ghc-options: -Wall

View file

@ -1,5 +1,5 @@
name: servant-client name: servant-client
version: 0.14 version: 0.15
synopsis: automatical derivation of querying functions for servant webservices synopsis: automatical derivation of querying functions for servant webservices
description: description:
This library lets you derive automatically Haskell functions that This library lets you derive automatically Haskell functions that
@ -39,34 +39,34 @@ library
-- Bundled with GHC: Lower bound to not force re-installs -- Bundled with GHC: Lower bound to not force re-installs
-- text and mtl are bundled starting with GHC-8.4 -- text and mtl are bundled starting with GHC-8.4
--
-- note: mtl lower bound is so low because of GHC-7.8
build-depends: build-depends:
base >= 4.7 && < 4.13 base >= 4.9 && < 4.13
, bytestring >= 0.10.4.0 && < 0.11 , bytestring >= 0.10.8.1 && < 0.11
, containers >= 0.5.5.1 && < 0.7 , containers >= 0.5.7.1 && < 0.7
, mtl >= 2.1 && < 2.3 , deepseq >= 1.4.2.0 && < 1.5
, mtl >= 2.2.2 && < 2.3
, stm >= 2.4.5.1 && < 2.6
, text >= 1.2.3.0 && < 1.3 , text >= 1.2.3.0 && < 1.3
, time >= 1.4.2 && < 1.9 , time >= 1.6.0.1 && < 1.9
, transformers >= 0.3.0.0 && < 0.6 , transformers >= 0.5.2.0 && < 0.6
-- Servant dependencies -- Servant dependencies.
-- Strict dependency on `servant-client-core` as we re-export things.
build-depends: build-depends:
servant == 0.14.* servant == 0.15.*
, servant-client-core == 0.14.* , servant-client-core == 0.15
-- Other dependencies: Lower bound around what is in the latest Stackage LTS. -- Other dependencies: Lower bound around what is in the latest Stackage LTS.
-- Here can be exceptions if we really need features from the newer versions. -- Here can be exceptions if we really need features from the newer versions.
build-depends: build-depends:
base-compat >= 0.10.1 && < 0.11 base-compat >= 0.10.5 && < 0.11
, http-client >= 0.5.12 && < 0.6 , http-client >= 0.5.13.1 && < 0.6
, http-media >= 0.7.1.2 && < 0.8 , http-media >= 0.7.1.3 && < 0.8
, http-types >= 0.12.1 && < 0.13 , http-types >= 0.12.2 && < 0.13
, exceptions >= 0.10.0 && < 0.11 , exceptions >= 0.10.0 && < 0.11
, kan-extensions >= 5.2 && < 5.3 , kan-extensions >= 5.2 && < 5.3
, monad-control >= 1.0.2.3 && < 1.1 , monad-control >= 1.0.2.3 && < 1.1
, semigroupoids >= 5.2.2 && < 5.4 , semigroupoids >= 5.3.1 && < 5.4
, stm >= 2.4.5.0 && < 2.6
, transformers-base >= 0.4.5.2 && < 0.5 , transformers-base >= 0.4.5.2 && < 0.5
, transformers-compat >= 0.6.2 && < 0.7 , transformers-compat >= 0.6.2 && < 0.7
@ -107,16 +107,16 @@ test-suite spec
build-depends: build-depends:
entropy >= 0.4.1.3 && < 0.5 entropy >= 0.4.1.3 && < 0.5
, generics-sop >= 0.4.0.1 && < 0.5 , generics-sop >= 0.4.0.1 && < 0.5
, hspec >= 2.5.8 && < 2.6 , hspec >= 2.6.0 && < 2.7
, HUnit >= 1.6 && < 1.7 , HUnit >= 1.6.0.0 && < 1.7
, network >= 2.8.0.0 && < 2.9 , network >= 2.8.0.0 && < 2.9
, QuickCheck >= 2.12.6.1 && < 2.13 , QuickCheck >= 2.12.6.1 && < 2.13
, servant == 0.14.* , servant == 0.15.*
, servant-server == 0.14.* , servant-server == 0.15.*
, tdigest >= 0.2 && < 0.3 , tdigest >= 0.2 && < 0.3
build-tool-depends: build-tool-depends:
hspec-discover:hspec-discover >= 2.5.8 && < 2.6 hspec-discover:hspec-discover >= 2.6.0 && < 2.7
test-suite readme test-suite readme
type: exitcode-stdio-1.0 type: exitcode-stdio-1.0

View file

@ -20,8 +20,11 @@ import Prelude ()
import Prelude.Compat import Prelude.Compat
import Control.Concurrent.STM.TVar import Control.Concurrent.STM.TVar
import Control.DeepSeq
(NFData, force)
import Control.Exception import Control.Exception
import Control.Monad (evaluate, throwIO)
import Control.Monad ()
import Control.Monad.Base import Control.Monad.Base
(MonadBase (..)) (MonadBase (..))
import Control.Monad.Codensity import Control.Monad.Codensity
@ -120,6 +123,19 @@ withClientM cm env k =
let Codensity f = runExceptT $ flip runReaderT env $ unClientM cm let Codensity f = runExceptT $ flip runReaderT env $ unClientM cm
in f k in f k
-- | A 'runClientM' variant for streaming client.
--
-- It allows using this module's 'ClientM' in a direct style.
-- The 'NFData' constraint however prevents using this function with genuine
-- streaming response types ('SourceT', 'Conduit', pipes 'Proxy' or 'Machine').
-- For those you have to use 'withClientM'.
--
-- /Note:/ we 'force' the result, so the likehood of accidentally leaking a
-- connection is smaller. Use with care.
--
runClientM :: NFData a => ClientM a -> ClientEnv -> IO (Either ServantError a)
runClientM cm env = withClientM cm env (evaluate . force)
performRequest :: Request -> ClientM Response performRequest :: Request -> ClientM Response
performRequest req = do performRequest req = do
-- TODO: should use Client.withResponse here too -- TODO: should use Client.withResponse here too

View file

@ -7,6 +7,7 @@ module Servant.Client.Streaming
( client ( client
, ClientM , ClientM
, withClientM , withClientM
, runClientM
, ClientEnv(..) , ClientEnv(..)
, mkClientEnv , mkClientEnv
, hoistClient , hoistClient

View file

@ -26,12 +26,12 @@ library
exposed-modules: Servant.Conduit exposed-modules: Servant.Conduit
build-depends: build-depends:
base >=4.9 && <5 base >=4.9 && <5
, bytestring >=0.10.4.0 && <0.11 , bytestring >=0.10.8.1 && <0.11
, conduit >=1.3.0.2 && <1.4 , conduit >=1.3.1 && <1.4
, mtl >=2.1 && <2.3 , mtl >=2.2.2 && <2.3
, resourcet >=1.2.1 && <1.3 , resourcet >=1.2.2 && <1.3
, servant >=0.14 && <0.15 , servant >=0.15 && <0.16
, unliftio-core >=0.1.1 && <0.2 , unliftio-core >=0.1.2.0 && <0.2
hs-source-dirs: src hs-source-dirs: src
default-language: Haskell2010 default-language: Haskell2010
ghc-options: -Wall ghc-options: -Wall
@ -51,9 +51,9 @@ test-suite example
, resourcet , resourcet
, servant , servant
, servant-conduit , servant-conduit
, servant-server >=0.14 && <0.15 , servant-server >=0.15 && <0.16
, servant-client >=0.14 && <0.15 , servant-client >=0.15 && <0.16
, wai >=3.0.3.0 && <3.3 , wai >=3.2.1.2 && <3.3
, warp >=3.0.13.1 && <3.3 , warp >=3.2.25 && <3.3
, http-client , http-client
default-language: Haskell2010 default-language: Haskell2010

View file

@ -1,6 +1,5 @@
name: servant-docs name: servant-docs
version: 0.11.2 version: 0.11.3
x-revision: 5
synopsis: generate API docs for your servant webservice synopsis: generate API docs for your servant webservice
description: description:
Library for generating API docs from a servant API definition. Library for generating API docs from a servant API definition.
@ -43,28 +42,28 @@ library
-- --
-- note: mtl lower bound is so low because of GHC-7.8 -- note: mtl lower bound is so low because of GHC-7.8
build-depends: build-depends:
base >= 4.7 && < 4.13 base >= 4.9 && < 4.13
, bytestring >= 0.10.4.0 && < 0.11 , bytestring >= 0.10.8.1 && < 0.11
, text >= 1.2.3.0 && < 1.3 , text >= 1.2.3.0 && < 1.3
-- Servant dependencies -- Servant dependencies
build-depends: build-depends:
servant == 0.13.* || ==0.14.* servant == 0.15.*
-- Other dependencies: Lower bound around what is in the latest Stackage LTS. -- Other dependencies: Lower bound around what is in the latest Stackage LTS.
-- Here can be exceptions if we really need features from the newer versions. -- Here can be exceptions if we really need features from the newer versions.
build-depends: build-depends:
aeson >= 1.2.3.0 && < 1.5 aeson >= 1.4.1.0 && < 1.5
, aeson-pretty >= 0.8.5 && < 0.9 , aeson-pretty >= 0.8.5 && < 0.9
, base-compat >= 0.9.3 && < 0.11 , base-compat >= 0.10.5 && < 0.11
, case-insensitive >= 1.2.0.10 && < 1.3 , case-insensitive >= 1.2.0.11 && < 1.3
, control-monad-omega >= 0.3.1 && < 0.4 , control-monad-omega >= 0.3.1 && < 0.4
, hashable >= 1.2.6.1 && < 1.3 , hashable >= 1.2.7.0 && < 1.3
, http-media >= 0.7.0 && < 0.8 , http-media >= 0.7.1.3 && < 0.8
, http-types >= 0.12 && < 0.13 , http-types >= 0.12.2 && < 0.13
, lens >= 4.15.4 && < 4.18 , lens >= 4.17 && < 4.18
, string-conversions >= 0.4.0.1 && < 0.5 , string-conversions >= 0.4.0.1 && < 0.5
, unordered-containers >= 0.2.8.0 && < 0.3 , unordered-containers >= 0.2.9.0 && < 0.3
hs-source-dirs: src hs-source-dirs: src
default-language: Haskell2010 default-language: Haskell2010

View file

@ -1,6 +1,5 @@
name: servant-foreign name: servant-foreign
version: 0.11.1 version: 0.15
x-revision: 3
synopsis: Helpers for generating clients for servant APIs in any programming language synopsis: Helpers for generating clients for servant APIs in any programming language
description: description:
Helper types and functions for generating client functions for servant APIs in any programming language Helper types and functions for generating client functions for servant APIs in any programming language
@ -42,19 +41,19 @@ library
-- --
-- note: mtl lower bound is so low because of GHC-7.8 -- note: mtl lower bound is so low because of GHC-7.8
build-depends: build-depends:
base >= 4.7 && <4.13 base >= 4.9 && < 4.13
, text >= 1.2.3.0 && < 1.3 , text >= 1.2.3.0 && < 1.3
-- Servant dependencies -- Servant dependencies
build-depends: build-depends:
servant == 0.13.* || ==0.14.* servant == 0.15.*
-- Other dependencies: Lower bound around what is in the latest Stackage LTS. -- Other dependencies: Lower bound around what is in the latest Stackage LTS.
-- Here can be exceptions if we really need features from the newer versions. -- Here can be exceptions if we really need features from the newer versions.
build-depends: build-depends:
base-compat >= 0.9.3 && <0.11 base-compat >= 0.10.5 && < 0.11
, lens >= 4.15.4 && <4.18 , lens >= 4.17 && < 4.18
, http-types >= 0.12 && < 0.13 , http-types >= 0.12.2 && < 0.13
hs-source-dirs: src hs-source-dirs: src
default-language: Haskell2010 default-language: Haskell2010
@ -75,8 +74,8 @@ test-suite spec
-- Additonal dependencies -- Additonal dependencies
build-depends: build-depends:
hspec >= 2.4.4 && <2.6 hspec >= 2.6.0 && <2.7
build-tool-depends: build-tool-depends:
hspec-discover:hspec-discover >=2.4.4 && <2.6 hspec-discover:hspec-discover >=2.6.0 && <2.7
default-language: Haskell2010 default-language: Haskell2010

View file

@ -26,10 +26,10 @@ library
exposed-modules: Servant.Machines exposed-modules: Servant.Machines
build-depends: build-depends:
base >=4.9 && <5 base >=4.9 && <5
, bytestring >=0.10.4.0 && <0.11 , bytestring >=0.10.8.1 && <0.11
, machines >=0.6.3 && <0.7 , machines >=0.6.4 && <0.7
, mtl >=2.1 && <2.3 , mtl >=2.2.2 && <2.3
, servant >=0.14 && <0.15 , servant >=0.15 && <0.16
hs-source-dirs: src hs-source-dirs: src
default-language: Haskell2010 default-language: Haskell2010
ghc-options: -Wall ghc-options: -Wall
@ -48,9 +48,9 @@ test-suite example
, servant , servant
, machines , machines
, servant-machines , servant-machines
, servant-server >=0.14 && <0.15 , servant-server >=0.15 && <0.16
, servant-client >=0.14 && <0.15 , servant-client >=0.15 && <0.16
, wai >=3.0.3.0 && <3.3 , wai >=3.2.1.2 && <3.3
, warp >=3.0.13.1 && <3.3 , warp >=3.2.25 && <3.3
, http-client , http-client
default-language: Haskell2010 default-language: Haskell2010

View file

@ -26,12 +26,12 @@ library
exposed-modules: Servant.Pipes exposed-modules: Servant.Pipes
build-depends: build-depends:
base >=4.9 && <5 base >=4.9 && <5
, bytestring >=0.10.4.0 && <0.11 , bytestring >=0.10.8.1 && <0.11
, pipes >=4.3.9 && <4.4 , pipes >=4.3.9 && <4.4
, pipes-safe >=2.3.1 && <2.4 , pipes-safe >=2.3.1 && <2.4
, mtl >=2.1 && <2.3 , mtl >=2.2.2 && <2.3
, monad-control >=1.0.2.3 && <1.1 , monad-control >=1.0.2.3 && <1.1
, servant >=0.14 && <0.15 , servant >=0.15 && <0.16
hs-source-dirs: src hs-source-dirs: src
default-language: Haskell2010 default-language: Haskell2010
ghc-options: -Wall ghc-options: -Wall
@ -52,9 +52,9 @@ test-suite example
, pipes-safe , pipes-safe
, servant-pipes , servant-pipes
, pipes-bytestring >=2.1.6 && <2.2 , pipes-bytestring >=2.1.6 && <2.2
, servant-server >=0.14 && <0.15 , servant-server >=0.15 && <0.16
, servant-client >=0.14 && <0.15 , servant-client >=0.15 && <0.16
, wai >=3.0.3.0 && <3.3 , wai >=3.2.1.2 && <3.3
, warp >=3.0.13.1 && <3.3 , warp >=3.2.25 && <3.3
, http-client , http-client
default-language: Haskell2010 default-language: Haskell2010

View file

@ -5,8 +5,10 @@
{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeOperators #-}
import Prelude ()
import Prelude.Compat
import Data.Aeson import Data.Aeson
import Data.Monoid
import Data.Proxy import Data.Proxy
import Data.Text import Data.Text
import GHC.Generics import GHC.Generics

View file

@ -1,5 +1,5 @@
name: servant-server name: servant-server
version: 0.14.1 version: 0.15
synopsis: A family of combinators for defining webservices APIs and serving them synopsis: A family of combinators for defining webservices APIs and serving them
description: description:
A family of combinators for defining webservices APIs and serving them A family of combinators for defining webservices APIs and serving them
@ -61,44 +61,37 @@ library
-- Bundled with GHC: Lower bound to not force re-installs -- Bundled with GHC: Lower bound to not force re-installs
-- text and mtl are bundled starting with GHC-8.4 -- text and mtl are bundled starting with GHC-8.4
--
-- note: mtl lower bound is so low because of GHC-7.8
build-depends: build-depends:
base >= 4.7 && < 4.13 base >= 4.9 && < 4.13
, bytestring >= 0.10.4.0 && < 0.11 , bytestring >= 0.10.8.1 && < 0.11
, containers >= 0.5.5.1 && < 0.7 , containers >= 0.5.7.1 && < 0.7
, mtl >= 2.1 && < 2.3 , mtl >= 2.2.2 && < 2.3
, text >= 1.2.3.0 && < 1.3 , text >= 1.2.3.0 && < 1.3
, transformers >= 0.3.0.0 && < 0.6 , transformers >= 0.5.2.0 && < 0.6
, filepath >= 1.3.0.2 && < 1.5 , filepath >= 1.4.1.1 && < 1.5
if !impl(ghc >= 8.0)
build-depends:
semigroups >= 0.18.4 && < 0.19
-- Servant dependencies -- Servant dependencies
build-depends: build-depends:
servant >= 0.14.1 && <0.15 servant >= 0.15 && < 0.16
-- Other dependencies: Lower bound around what is in the latest Stackage LTS. -- Other dependencies: Lower bound around what is in the latest Stackage LTS.
-- Here can be exceptions if we really need features from the newer versions. -- Here can be exceptions if we really need features from the newer versions.
build-depends: build-depends:
base-compat >= 0.10.1 && < 0.11 base-compat >= 0.10.5 && < 0.11
, base64-bytestring >= 1.0.0.1 && < 1.1 , base64-bytestring >= 1.0.0.1 && < 1.1
, exceptions >= 0.10.0 && < 0.11 , exceptions >= 0.10.0 && < 0.11
, http-api-data >= 0.3.8.1 && < 0.4 , http-api-data >= 0.3.10 && < 0.4
, http-media >= 0.7.1.2 && < 0.8 , http-media >= 0.7.1.3 && < 0.8
, http-types >= 0.12.1 && < 0.13 , http-types >= 0.12.2 && < 0.13
, network-uri >= 2.6.1.0 && < 2.7 , network-uri >= 2.6.1.0 && < 2.7
, monad-control >= 1.0.2.3 && < 1.1 , monad-control >= 1.0.2.3 && < 1.1
, network >= 2.6.3.5 && < 2.9 , network >= 2.8 && < 2.9
, string-conversions >= 0.4.0.1 && < 0.5 , string-conversions >= 0.4.0.1 && < 0.5
, resourcet >= 1.1.11 && < 1.3 , resourcet >= 1.2.2 && < 1.3
, tagged >= 0.8.5 && < 0.9 , tagged >= 0.8.6 && < 0.9
, transformers-base >= 0.4.4 && < 0.5 , transformers-base >= 0.4.5.2 && < 0.5
, transformers-compat >= 0.6.2 && < 0.7 , wai >= 3.2.1.2 && < 3.3
, wai >= 3.2.1.1 && < 3.3 , wai-app-static >= 3.1.6.2 && < 3.2
, wai-app-static >= 3.1.6.1 && < 3.2
, word8 >= 0.1.3 && < 0.2 , word8 >= 0.1.3 && < 0.2
hs-source-dirs: src hs-source-dirs: src
@ -112,14 +105,15 @@ executable greet
default-language: Haskell2010 default-language: Haskell2010
build-depends: build-depends:
base base
, base-compat
, servant , servant
, servant-server , servant-server
, wai , wai
, text , text
build-depends: build-depends:
aeson >= 1.3.1.1 && < 1.5 aeson >= 1.4.1.0 && < 1.5
, warp >= 3.2.13 && < 3.3 , warp >= 3.2.25 && < 3.3
test-suite spec test-suite spec
type: exitcode-stdio-1.0 type: exitcode-stdio-1.0
@ -160,17 +154,17 @@ test-suite spec
-- Additonal dependencies -- Additonal dependencies
build-depends: build-depends:
aeson >= 1.3.1.1 && < 1.5 aeson >= 1.4.1.0 && < 1.5
, directory >= 1.2.1.0 && < 1.4 , directory >= 1.3.0.0 && < 1.4
, hspec >= 2.5.1 && < 2.6 , hspec >= 2.6.0 && < 2.7
, hspec-wai >= 0.9.0 && < 0.10 , hspec-wai >= 0.9.0 && < 0.10
, QuickCheck >= 2.12.6.1 && < 2.13 , QuickCheck >= 2.12.6.1 && < 2.13
, should-not-typecheck >= 2.1.0 && < 2.2 , should-not-typecheck >= 2.1.0 && < 2.2
, temporary >= 1.3 && < 1.4 , temporary >= 1.3 && < 1.4
, wai-extra >= 3.0.21.0 && < 3.1 , wai-extra >= 3.0.24.3 && < 3.1
build-tool-depends: build-tool-depends:
hspec-discover:hspec-discover >= 2.5.1 && <2.6 hspec-discover:hspec-discover >= 2.6.0 && <2.7
test-suite doctests test-suite doctests
build-depends: build-depends:

View file

@ -4,10 +4,12 @@
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
module Servant.Server.Internal.Router where module Servant.Server.Internal.Router where
import Prelude ()
import Prelude.Compat
import Data.Map import Data.Map
(Map) (Map)
import qualified Data.Map as M import qualified Data.Map as M
import Data.Monoid
import Data.Text import Data.Text
(Text) (Text)
import qualified Data.Text as T import qualified Data.Text as T

View file

@ -1,5 +1,5 @@
name: servant name: servant
version: 0.14.1 version: 0.15
synopsis: A family of combinators for defining webservices APIs synopsis: A family of combinators for defining webservices APIs
description: description:
A family of combinators for defining webservices APIs and serving them A family of combinators for defining webservices APIs and serving them
@ -86,31 +86,27 @@ library
build-depends: build-depends:
base >= 4.9 && < 4.13 base >= 4.9 && < 4.13
, bytestring >= 0.10.8.1 && < 0.11 , bytestring >= 0.10.8.1 && < 0.11
, mtl >= 2.1 && < 2.3 , mtl >= 2.2.2 && < 2.3
, transformers >= 0.3.0.0 && < 0.6 , transformers >= 0.5.2.0 && < 0.6
, text >= 1.2.3.0 && < 1.3 , text >= 1.2.3.0 && < 1.3
if !impl(ghc >= 8.0)
build-depends:
semigroups >= 0.18.5 && < 0.19
-- Other dependencies: Lower bound around what is in the latest Stackage LTS. -- Other dependencies: Lower bound around what is in the latest Stackage LTS.
-- Here can be exceptions if we really need features from the newer versions. -- Here can be exceptions if we really need features from the newer versions.
build-depends: build-depends:
base-compat >= 0.10.5 && < 0.11 base-compat >= 0.10.5 && < 0.11
, aeson >= 1.3.1.1 && < 1.5 , aeson >= 1.4.1.0 && < 1.5
, attoparsec >= 0.13.2.2 && < 0.14 , attoparsec >= 0.13.2.2 && < 0.14
, bifunctors >= 5.5.3 && < 5.6 , bifunctors >= 5.5.3 && < 5.6
, case-insensitive >= 1.2.0.11 && < 1.3 , case-insensitive >= 1.2.0.11 && < 1.3
, http-api-data >= 0.3.8.1 && < 0.4 , http-api-data >= 0.3.10 && < 0.4
, http-media >= 0.7.1.2 && < 0.8 , http-media >= 0.7.1.3 && < 0.8
, http-types >= 0.12.1 && < 0.13 , http-types >= 0.12.2 && < 0.13
, mmorph >= 1.1.2 && < 1.2 , mmorph >= 1.1.2 && < 1.2
, network-uri >= 2.6.1.0 && < 2.7 , network-uri >= 2.6.1.0 && < 2.7
, singleton-bool >= 0.1.4 && < 0.2 , singleton-bool >= 0.1.4 && < 0.2
, string-conversions >= 0.4.0.1 && < 0.5 , string-conversions >= 0.4.0.1 && < 0.5
, tagged >= 0.8.5 && < 0.9 , tagged >= 0.8.6 && < 0.9
, vault >= 0.3.1.1 && < 0.4 , vault >= 0.3.1.2 && < 0.4
hs-source-dirs: src hs-source-dirs: src
default-language: Haskell2010 default-language: Haskell2010
@ -161,13 +157,12 @@ test-suite spec
-- Additonal dependencies -- Additonal dependencies
build-depends: build-depends:
aeson-compat >= 0.3.8 && < 0.4 hspec >= 2.6.0 && < 2.7
, hspec >= 2.5.4 && < 2.6
, QuickCheck >= 2.12.6.1 && < 2.13 , QuickCheck >= 2.12.6.1 && < 2.13
, quickcheck-instances >= 0.3.19 && < 0.4 , quickcheck-instances >= 0.3.19 && < 0.4
build-tool-depends: build-tool-depends:
hspec-discover:hspec-discover >= 2.5.4 && < 2.6 hspec-discover:hspec-discover >= 2.6.0 && < 2.7
test-suite doctests test-suite doctests
build-depends: build-depends:
@ -177,7 +172,7 @@ test-suite doctests
-- We test Links failure with doctest, so we need extra dependencies -- We test Links failure with doctest, so we need extra dependencies
build-depends: build-depends:
hspec >= 2.5.4 && < 2.6 hspec >= 2.6.0 && < 2.7
type: exitcode-stdio-1.0 type: exitcode-stdio-1.0
main-is: test/doctests.hs main-is: test/doctests.hs

View file

@ -10,7 +10,8 @@ module Servant.API.ContentTypesSpec where
import Prelude () import Prelude ()
import Prelude.Compat import Prelude.Compat
import Data.Aeson.Compat import Data.Aeson
(FromJSON, ToJSON (..), Value, decode, encode, object, (.=))
import Data.ByteString.Char8 import Data.ByteString.Char8
(ByteString, append, pack) (ByteString, append, pack)
import qualified Data.ByteString.Lazy as BSL import qualified Data.ByteString.Lazy as BSL

View file

@ -16,10 +16,18 @@ packages:
# - doc/tutorial/ # - doc/tutorial/
extra-deps: extra-deps:
- base-compat-0.10.5
- conduit-1.3.1
- generics-sop-0.4.0.1 - generics-sop-0.4.0.1
- sop-core-0.4.0.0 - hspec-2.6.0
- QuickCheck-2.12.6.1 - hspec-core-2.6.0
- hspec-discover-2.6.0
- http-api-data-0.3.10
- http-media-0.7.1.3
- network-2.8.0.0 - network-2.8.0.0
- hspec-2.5.8 - pipes-safe-2.3.1
- hspec-core-2.5.8 - QuickCheck-2.12.6.1
- hspec-discover-2.5.8 - resourcet-1.2.2
- sop-core-0.4.0.0
- wai-extra-3.0.24.3
- tasty-1.1.0.4