Merge pull request #1076 from phadej/run-streaming-client
Add runClientM for streaming-client
This commit is contained in:
commit
bbf196717f
23 changed files with 206 additions and 156 deletions
|
@ -71,7 +71,7 @@ install:
|
|||
- 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"
|
||||
- "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
|
||||
- "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
|
||||
|
@ -168,7 +168,7 @@ script:
|
|||
- 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"
|
||||
- "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
|
||||
- "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
|
||||
|
|
|
@ -38,5 +38,9 @@ constraints:
|
|||
memory <0.14.12 || >0.14.12
|
||||
|
||||
allow-newer:
|
||||
servant-pagination:servant,
|
||||
servant-pagination:servant-server
|
||||
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
|
||||
|
|
|
@ -22,7 +22,7 @@ Language extensions and imports:
|
|||
{-# LANGUAGE TypeOperators #-}
|
||||
|
||||
import Control.Lens ((^.))
|
||||
import Data.Aeson.Compat
|
||||
import Data.Aeson
|
||||
import Data.Aeson.Text
|
||||
import Data.Monoid ((<>))
|
||||
import Data.Proxy (Proxy (Proxy))
|
||||
|
|
|
@ -14,7 +14,6 @@ executable cookbock-curl-mock
|
|||
main-is: CurlMock.lhs
|
||||
build-depends: base == 4.*
|
||||
, aeson
|
||||
, aeson-compat
|
||||
, lens
|
||||
, text
|
||||
, servant
|
||||
|
|
|
@ -29,7 +29,7 @@ import Prelude.Compat
|
|||
|
||||
import Control.Monad.Except
|
||||
import Control.Monad.Reader
|
||||
import Data.Aeson.Compat
|
||||
import Data.Aeson
|
||||
import Data.Aeson.Types
|
||||
import Data.Attoparsec.ByteString
|
||||
import Data.ByteString (ByteString)
|
||||
|
|
|
@ -36,7 +36,6 @@ library
|
|||
build-depends:
|
||||
base >= 4.7 && <4.13
|
||||
, aeson
|
||||
, aeson-compat
|
||||
, attoparsec
|
||||
, base-compat
|
||||
, bytestring
|
||||
|
@ -67,11 +66,10 @@ library
|
|||
, blaze-markup >= 0.8.0.0 && < 0.9
|
||||
, cookie >= 0.4.3 && < 0.5
|
||||
, js-jquery >= 3.2.1 && < 3.3
|
||||
, lucid >= 2.9.9 && < 2.10
|
||||
, mtl-compat >= 0.2.1 && < 0.3
|
||||
, lucid >= 2.9.11 && < 2.10
|
||||
, random >= 1.1 && < 1.2
|
||||
, 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
|
||||
build-depends: markdown-unlit >= 0.5.0 && <0.6
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: servant-client-core
|
||||
version: 0.14.1
|
||||
version: 0.15
|
||||
synopsis: Core functionality and class for client function generation for servant APIs
|
||||
description:
|
||||
This library provides backend-agnostic generation of client functions. For
|
||||
|
@ -50,26 +50,27 @@ library
|
|||
base >= 4.9 && < 4.13
|
||||
, bytestring >= 0.10.8.1 && < 0.11
|
||||
, containers >= 0.5.7.1 && < 0.7
|
||||
, deepseq >= 1.4.2.0 && < 1.5
|
||||
, text >= 1.2.3.0 && < 1.3
|
||||
, transformers >= 0.5.2.0 && < 0.6
|
||||
, template-haskell >= 2.11.1.0 && < 2.15
|
||||
|
||||
-- Servant dependencies
|
||||
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.
|
||||
-- Here can be exceptions if we really need features from the newer versions.
|
||||
build-depends:
|
||||
aeson >= 1.4.0.0 && < 1.5
|
||||
, base-compat >= 0.10.1 && < 0.11
|
||||
aeson >= 1.4.1.0 && < 1.5
|
||||
, base-compat >= 0.10.5 && < 0.11
|
||||
, base64-bytestring >= 1.0.0.1 && < 1.1
|
||||
, 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
|
||||
, http-api-data >= 0.3.8.1 && < 0.4
|
||||
, http-media >= 0.7.1.2 && < 0.8
|
||||
, http-types >= 0.12.1 && < 0.13
|
||||
, http-api-data >= 0.3.10 && < 0.4
|
||||
, http-media >= 0.7.1.3 && < 0.8
|
||||
, http-types >= 0.12.2 && < 0.13
|
||||
, network-uri >= 2.6.1.0 && < 2.7
|
||||
, safe >= 0.3.17 && < 0.4
|
||||
|
||||
|
@ -94,9 +95,9 @@ test-suite spec
|
|||
|
||||
-- Additonal dependencies
|
||||
build-depends:
|
||||
deepseq >= 1.3.0.2 && < 1.5
|
||||
, hspec >= 2.4.1 && < 2.6
|
||||
deepseq >= 1.4.2.0 && < 1.5
|
||||
, hspec >= 2.6.0 && < 2.7
|
||||
, QuickCheck >= 2.12.6.1 && < 2.13
|
||||
|
||||
build-tool-depends:
|
||||
hspec-discover:hspec-discover >= 2.5.1 && <2.6
|
||||
hspec-discover:hspec-discover >= 2.6.0 && <2.7
|
||||
|
|
|
@ -15,6 +15,8 @@ module Servant.Client.Core.Internal.Request where
|
|||
import Prelude ()
|
||||
import Prelude.Compat
|
||||
|
||||
import Control.DeepSeq
|
||||
(NFData (..))
|
||||
import Control.Monad.Catch
|
||||
(Exception)
|
||||
import qualified Data.ByteString as BS
|
||||
|
@ -34,10 +36,10 @@ import Data.Typeable
|
|||
import GHC.Generics
|
||||
(Generic)
|
||||
import Network.HTTP.Media
|
||||
(MediaType)
|
||||
(MediaType, mainType, parameters, subType)
|
||||
import Network.HTTP.Types
|
||||
(Header, HeaderName, HttpVersion, Method, QueryItem, Status,
|
||||
http11, methodGet)
|
||||
(Header, HeaderName, HttpVersion (..), Method, QueryItem,
|
||||
Status (..), http11, methodGet)
|
||||
import Web.HttpApiData
|
||||
(ToHttpApiData, toEncodedUrlPiece, toHeader)
|
||||
|
||||
|
@ -59,6 +61,20 @@ data 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
|
||||
{ requestPath :: a
|
||||
, requestQueryString :: Seq.Seq QueryItem
|
||||
|
@ -88,6 +104,16 @@ data GenResponse a = Response
|
|||
, responseBody :: a
|
||||
} 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 StreamingResponse = GenResponse (IO BS.ByteString)
|
||||
|
||||
|
|
|
@ -41,12 +41,17 @@ library
|
|||
, http-media >= 0.6.2 && < 0.8
|
||||
, http-types >= 0.12 && < 0.13
|
||||
, monad-control >= 1.0.0.4 && < 1.1
|
||||
, mtl >= 2.1 && < 2.3
|
||||
, mtl >= 2.2.2 && < 2.3
|
||||
, semigroupoids >= 4.3 && < 5.3
|
||||
, servant-client-core == 0.14.*
|
||||
, string-conversions >= 0.3 && < 0.5
|
||||
, transformers >= 0.3 && < 0.6
|
||||
, transformers-base >= 0.4.4 && < 0.5
|
||||
|
||||
|
||||
-- strict, as we re-export stuff
|
||||
build-depends:
|
||||
servant-client-core == 0.15
|
||||
|
||||
hs-source-dirs: src
|
||||
default-language: Haskell2010
|
||||
ghc-options: -Wall
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: servant-client
|
||||
version: 0.14
|
||||
version: 0.15
|
||||
synopsis: automatical derivation of querying functions for servant webservices
|
||||
description:
|
||||
This library lets you derive automatically Haskell functions that
|
||||
|
@ -39,34 +39,34 @@ library
|
|||
|
||||
-- Bundled with GHC: Lower bound to not force re-installs
|
||||
-- text and mtl are bundled starting with GHC-8.4
|
||||
--
|
||||
-- note: mtl lower bound is so low because of GHC-7.8
|
||||
build-depends:
|
||||
base >= 4.7 && < 4.13
|
||||
, bytestring >= 0.10.4.0 && < 0.11
|
||||
, containers >= 0.5.5.1 && < 0.7
|
||||
, mtl >= 2.1 && < 2.3
|
||||
base >= 4.9 && < 4.13
|
||||
, bytestring >= 0.10.8.1 && < 0.11
|
||||
, containers >= 0.5.7.1 && < 0.7
|
||||
, 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
|
||||
, time >= 1.4.2 && < 1.9
|
||||
, transformers >= 0.3.0.0 && < 0.6
|
||||
, time >= 1.6.0.1 && < 1.9
|
||||
, transformers >= 0.5.2.0 && < 0.6
|
||||
|
||||
-- Servant dependencies
|
||||
-- Servant dependencies.
|
||||
-- Strict dependency on `servant-client-core` as we re-export things.
|
||||
build-depends:
|
||||
servant == 0.14.*
|
||||
, servant-client-core == 0.14.*
|
||||
servant == 0.15.*
|
||||
, servant-client-core == 0.15
|
||||
|
||||
-- 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.
|
||||
build-depends:
|
||||
base-compat >= 0.10.1 && < 0.11
|
||||
, http-client >= 0.5.12 && < 0.6
|
||||
, http-media >= 0.7.1.2 && < 0.8
|
||||
, http-types >= 0.12.1 && < 0.13
|
||||
base-compat >= 0.10.5 && < 0.11
|
||||
, http-client >= 0.5.13.1 && < 0.6
|
||||
, http-media >= 0.7.1.3 && < 0.8
|
||||
, http-types >= 0.12.2 && < 0.13
|
||||
, exceptions >= 0.10.0 && < 0.11
|
||||
, kan-extensions >= 5.2 && < 5.3
|
||||
, monad-control >= 1.0.2.3 && < 1.1
|
||||
, semigroupoids >= 5.2.2 && < 5.4
|
||||
, stm >= 2.4.5.0 && < 2.6
|
||||
, semigroupoids >= 5.3.1 && < 5.4
|
||||
, transformers-base >= 0.4.5.2 && < 0.5
|
||||
, transformers-compat >= 0.6.2 && < 0.7
|
||||
|
||||
|
@ -107,16 +107,16 @@ test-suite spec
|
|||
build-depends:
|
||||
entropy >= 0.4.1.3 && < 0.5
|
||||
, generics-sop >= 0.4.0.1 && < 0.5
|
||||
, hspec >= 2.5.8 && < 2.6
|
||||
, HUnit >= 1.6 && < 1.7
|
||||
, hspec >= 2.6.0 && < 2.7
|
||||
, HUnit >= 1.6.0.0 && < 1.7
|
||||
, network >= 2.8.0.0 && < 2.9
|
||||
, QuickCheck >= 2.12.6.1 && < 2.13
|
||||
, servant == 0.14.*
|
||||
, servant-server == 0.14.*
|
||||
, servant == 0.15.*
|
||||
, servant-server == 0.15.*
|
||||
, tdigest >= 0.2 && < 0.3
|
||||
|
||||
build-tool-depends:
|
||||
hspec-discover:hspec-discover >= 2.5.8 && < 2.6
|
||||
hspec-discover:hspec-discover >= 2.6.0 && < 2.7
|
||||
|
||||
test-suite readme
|
||||
type: exitcode-stdio-1.0
|
||||
|
|
|
@ -20,8 +20,11 @@ import Prelude ()
|
|||
import Prelude.Compat
|
||||
|
||||
import Control.Concurrent.STM.TVar
|
||||
import Control.DeepSeq
|
||||
(NFData, force)
|
||||
import Control.Exception
|
||||
import Control.Monad
|
||||
(evaluate, throwIO)
|
||||
import Control.Monad ()
|
||||
import Control.Monad.Base
|
||||
(MonadBase (..))
|
||||
import Control.Monad.Codensity
|
||||
|
@ -120,6 +123,19 @@ withClientM cm env k =
|
|||
let Codensity f = runExceptT $ flip runReaderT env $ unClientM cm
|
||||
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 req = do
|
||||
-- TODO: should use Client.withResponse here too
|
||||
|
|
|
@ -7,6 +7,7 @@ module Servant.Client.Streaming
|
|||
( client
|
||||
, ClientM
|
||||
, withClientM
|
||||
, runClientM
|
||||
, ClientEnv(..)
|
||||
, mkClientEnv
|
||||
, hoistClient
|
||||
|
|
|
@ -26,12 +26,12 @@ library
|
|||
exposed-modules: Servant.Conduit
|
||||
build-depends:
|
||||
base >=4.9 && <5
|
||||
, bytestring >=0.10.4.0 && <0.11
|
||||
, conduit >=1.3.0.2 && <1.4
|
||||
, mtl >=2.1 && <2.3
|
||||
, resourcet >=1.2.1 && <1.3
|
||||
, servant >=0.14 && <0.15
|
||||
, unliftio-core >=0.1.1 && <0.2
|
||||
, bytestring >=0.10.8.1 && <0.11
|
||||
, conduit >=1.3.1 && <1.4
|
||||
, mtl >=2.2.2 && <2.3
|
||||
, resourcet >=1.2.2 && <1.3
|
||||
, servant >=0.15 && <0.16
|
||||
, unliftio-core >=0.1.2.0 && <0.2
|
||||
hs-source-dirs: src
|
||||
default-language: Haskell2010
|
||||
ghc-options: -Wall
|
||||
|
@ -51,9 +51,9 @@ test-suite example
|
|||
, resourcet
|
||||
, servant
|
||||
, servant-conduit
|
||||
, servant-server >=0.14 && <0.15
|
||||
, servant-client >=0.14 && <0.15
|
||||
, wai >=3.0.3.0 && <3.3
|
||||
, warp >=3.0.13.1 && <3.3
|
||||
, servant-server >=0.15 && <0.16
|
||||
, servant-client >=0.15 && <0.16
|
||||
, wai >=3.2.1.2 && <3.3
|
||||
, warp >=3.2.25 && <3.3
|
||||
, http-client
|
||||
default-language: Haskell2010
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
name: servant-docs
|
||||
version: 0.11.2
|
||||
x-revision: 5
|
||||
version: 0.11.3
|
||||
synopsis: generate API docs for your servant webservice
|
||||
description:
|
||||
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
|
||||
build-depends:
|
||||
base >= 4.7 && < 4.13
|
||||
, bytestring >= 0.10.4.0 && < 0.11
|
||||
base >= 4.9 && < 4.13
|
||||
, bytestring >= 0.10.8.1 && < 0.11
|
||||
, text >= 1.2.3.0 && < 1.3
|
||||
|
||||
-- Servant dependencies
|
||||
build-depends:
|
||||
servant == 0.13.* || ==0.14.*
|
||||
servant == 0.15.*
|
||||
|
||||
-- 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.
|
||||
build-depends:
|
||||
aeson >= 1.2.3.0 && < 1.5
|
||||
aeson >= 1.4.1.0 && < 1.5
|
||||
, aeson-pretty >= 0.8.5 && < 0.9
|
||||
, base-compat >= 0.9.3 && < 0.11
|
||||
, case-insensitive >= 1.2.0.10 && < 1.3
|
||||
, base-compat >= 0.10.5 && < 0.11
|
||||
, case-insensitive >= 1.2.0.11 && < 1.3
|
||||
, control-monad-omega >= 0.3.1 && < 0.4
|
||||
, hashable >= 1.2.6.1 && < 1.3
|
||||
, http-media >= 0.7.0 && < 0.8
|
||||
, http-types >= 0.12 && < 0.13
|
||||
, lens >= 4.15.4 && < 4.18
|
||||
, hashable >= 1.2.7.0 && < 1.3
|
||||
, http-media >= 0.7.1.3 && < 0.8
|
||||
, http-types >= 0.12.2 && < 0.13
|
||||
, lens >= 4.17 && < 4.18
|
||||
, 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
|
||||
default-language: Haskell2010
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
name: servant-foreign
|
||||
version: 0.11.1
|
||||
x-revision: 3
|
||||
version: 0.15
|
||||
synopsis: Helpers for generating clients for servant APIs in any programming language
|
||||
description:
|
||||
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
|
||||
build-depends:
|
||||
base >= 4.7 && <4.13
|
||||
base >= 4.9 && < 4.13
|
||||
, text >= 1.2.3.0 && < 1.3
|
||||
|
||||
-- Servant dependencies
|
||||
build-depends:
|
||||
servant == 0.13.* || ==0.14.*
|
||||
servant == 0.15.*
|
||||
|
||||
-- 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.
|
||||
build-depends:
|
||||
base-compat >= 0.9.3 && <0.11
|
||||
, lens >= 4.15.4 && <4.18
|
||||
, http-types >= 0.12 && < 0.13
|
||||
base-compat >= 0.10.5 && < 0.11
|
||||
, lens >= 4.17 && < 4.18
|
||||
, http-types >= 0.12.2 && < 0.13
|
||||
|
||||
hs-source-dirs: src
|
||||
default-language: Haskell2010
|
||||
|
@ -75,8 +74,8 @@ test-suite spec
|
|||
|
||||
-- Additonal dependencies
|
||||
build-depends:
|
||||
hspec >= 2.4.4 && <2.6
|
||||
hspec >= 2.6.0 && <2.7
|
||||
|
||||
build-tool-depends:
|
||||
hspec-discover:hspec-discover >=2.4.4 && <2.6
|
||||
hspec-discover:hspec-discover >=2.6.0 && <2.7
|
||||
default-language: Haskell2010
|
||||
|
|
|
@ -26,10 +26,10 @@ library
|
|||
exposed-modules: Servant.Machines
|
||||
build-depends:
|
||||
base >=4.9 && <5
|
||||
, bytestring >=0.10.4.0 && <0.11
|
||||
, machines >=0.6.3 && <0.7
|
||||
, mtl >=2.1 && <2.3
|
||||
, servant >=0.14 && <0.15
|
||||
, bytestring >=0.10.8.1 && <0.11
|
||||
, machines >=0.6.4 && <0.7
|
||||
, mtl >=2.2.2 && <2.3
|
||||
, servant >=0.15 && <0.16
|
||||
hs-source-dirs: src
|
||||
default-language: Haskell2010
|
||||
ghc-options: -Wall
|
||||
|
@ -48,9 +48,9 @@ test-suite example
|
|||
, servant
|
||||
, machines
|
||||
, servant-machines
|
||||
, servant-server >=0.14 && <0.15
|
||||
, servant-client >=0.14 && <0.15
|
||||
, wai >=3.0.3.0 && <3.3
|
||||
, warp >=3.0.13.1 && <3.3
|
||||
, servant-server >=0.15 && <0.16
|
||||
, servant-client >=0.15 && <0.16
|
||||
, wai >=3.2.1.2 && <3.3
|
||||
, warp >=3.2.25 && <3.3
|
||||
, http-client
|
||||
default-language: Haskell2010
|
||||
|
|
|
@ -26,12 +26,12 @@ library
|
|||
exposed-modules: Servant.Pipes
|
||||
build-depends:
|
||||
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-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
|
||||
, servant >=0.14 && <0.15
|
||||
, servant >=0.15 && <0.16
|
||||
hs-source-dirs: src
|
||||
default-language: Haskell2010
|
||||
ghc-options: -Wall
|
||||
|
@ -52,9 +52,9 @@ test-suite example
|
|||
, pipes-safe
|
||||
, servant-pipes
|
||||
, pipes-bytestring >=2.1.6 && <2.2
|
||||
, servant-server >=0.14 && <0.15
|
||||
, servant-client >=0.14 && <0.15
|
||||
, wai >=3.0.3.0 && <3.3
|
||||
, warp >=3.0.13.1 && <3.3
|
||||
, servant-server >=0.15 && <0.16
|
||||
, servant-client >=0.15 && <0.16
|
||||
, wai >=3.2.1.2 && <3.3
|
||||
, warp >=3.2.25 && <3.3
|
||||
, http-client
|
||||
default-language: Haskell2010
|
||||
|
|
|
@ -5,8 +5,10 @@
|
|||
{-# LANGUAGE TypeFamilies #-}
|
||||
{-# LANGUAGE TypeOperators #-}
|
||||
|
||||
import Prelude ()
|
||||
import Prelude.Compat
|
||||
|
||||
import Data.Aeson
|
||||
import Data.Monoid
|
||||
import Data.Proxy
|
||||
import Data.Text
|
||||
import GHC.Generics
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: servant-server
|
||||
version: 0.14.1
|
||||
version: 0.15
|
||||
synopsis: A family of combinators for defining webservices APIs and serving them
|
||||
description:
|
||||
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
|
||||
-- text and mtl are bundled starting with GHC-8.4
|
||||
--
|
||||
-- note: mtl lower bound is so low because of GHC-7.8
|
||||
build-depends:
|
||||
base >= 4.7 && < 4.13
|
||||
, bytestring >= 0.10.4.0 && < 0.11
|
||||
, containers >= 0.5.5.1 && < 0.7
|
||||
, mtl >= 2.1 && < 2.3
|
||||
base >= 4.9 && < 4.13
|
||||
, bytestring >= 0.10.8.1 && < 0.11
|
||||
, containers >= 0.5.7.1 && < 0.7
|
||||
, mtl >= 2.2.2 && < 2.3
|
||||
, text >= 1.2.3.0 && < 1.3
|
||||
, transformers >= 0.3.0.0 && < 0.6
|
||||
, filepath >= 1.3.0.2 && < 1.5
|
||||
|
||||
if !impl(ghc >= 8.0)
|
||||
build-depends:
|
||||
semigroups >= 0.18.4 && < 0.19
|
||||
, transformers >= 0.5.2.0 && < 0.6
|
||||
, filepath >= 1.4.1.1 && < 1.5
|
||||
|
||||
-- Servant dependencies
|
||||
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.
|
||||
-- Here can be exceptions if we really need features from the newer versions.
|
||||
build-depends:
|
||||
base-compat >= 0.10.1 && < 0.11
|
||||
base-compat >= 0.10.5 && < 0.11
|
||||
, base64-bytestring >= 1.0.0.1 && < 1.1
|
||||
, exceptions >= 0.10.0 && < 0.11
|
||||
, http-api-data >= 0.3.8.1 && < 0.4
|
||||
, http-media >= 0.7.1.2 && < 0.8
|
||||
, http-types >= 0.12.1 && < 0.13
|
||||
, http-api-data >= 0.3.10 && < 0.4
|
||||
, http-media >= 0.7.1.3 && < 0.8
|
||||
, http-types >= 0.12.2 && < 0.13
|
||||
, network-uri >= 2.6.1.0 && < 2.7
|
||||
, 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
|
||||
, resourcet >= 1.1.11 && < 1.3
|
||||
, tagged >= 0.8.5 && < 0.9
|
||||
, transformers-base >= 0.4.4 && < 0.5
|
||||
, transformers-compat >= 0.6.2 && < 0.7
|
||||
, wai >= 3.2.1.1 && < 3.3
|
||||
, wai-app-static >= 3.1.6.1 && < 3.2
|
||||
, resourcet >= 1.2.2 && < 1.3
|
||||
, tagged >= 0.8.6 && < 0.9
|
||||
, transformers-base >= 0.4.5.2 && < 0.5
|
||||
, wai >= 3.2.1.2 && < 3.3
|
||||
, wai-app-static >= 3.1.6.2 && < 3.2
|
||||
, word8 >= 0.1.3 && < 0.2
|
||||
|
||||
hs-source-dirs: src
|
||||
|
@ -112,14 +105,15 @@ executable greet
|
|||
default-language: Haskell2010
|
||||
build-depends:
|
||||
base
|
||||
, base-compat
|
||||
, servant
|
||||
, servant-server
|
||||
, wai
|
||||
, text
|
||||
|
||||
build-depends:
|
||||
aeson >= 1.3.1.1 && < 1.5
|
||||
, warp >= 3.2.13 && < 3.3
|
||||
aeson >= 1.4.1.0 && < 1.5
|
||||
, warp >= 3.2.25 && < 3.3
|
||||
|
||||
test-suite spec
|
||||
type: exitcode-stdio-1.0
|
||||
|
@ -160,17 +154,17 @@ test-suite spec
|
|||
|
||||
-- Additonal dependencies
|
||||
build-depends:
|
||||
aeson >= 1.3.1.1 && < 1.5
|
||||
, directory >= 1.2.1.0 && < 1.4
|
||||
, hspec >= 2.5.1 && < 2.6
|
||||
aeson >= 1.4.1.0 && < 1.5
|
||||
, directory >= 1.3.0.0 && < 1.4
|
||||
, hspec >= 2.6.0 && < 2.7
|
||||
, hspec-wai >= 0.9.0 && < 0.10
|
||||
, QuickCheck >= 2.12.6.1 && < 2.13
|
||||
, should-not-typecheck >= 2.1.0 && < 2.2
|
||||
, temporary >= 1.3 && < 1.4
|
||||
, wai-extra >= 3.0.21.0 && < 3.1
|
||||
, wai-extra >= 3.0.24.3 && < 3.1
|
||||
|
||||
build-tool-depends:
|
||||
hspec-discover:hspec-discover >= 2.5.1 && <2.6
|
||||
hspec-discover:hspec-discover >= 2.6.0 && <2.7
|
||||
|
||||
test-suite doctests
|
||||
build-depends:
|
||||
|
|
|
@ -4,10 +4,12 @@
|
|||
{-# LANGUAGE OverloadedStrings #-}
|
||||
module Servant.Server.Internal.Router where
|
||||
|
||||
import Prelude ()
|
||||
import Prelude.Compat
|
||||
|
||||
import Data.Map
|
||||
(Map)
|
||||
import qualified Data.Map as M
|
||||
import Data.Monoid
|
||||
import Data.Text
|
||||
(Text)
|
||||
import qualified Data.Text as T
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: servant
|
||||
version: 0.14.1
|
||||
version: 0.15
|
||||
synopsis: A family of combinators for defining webservices APIs
|
||||
description:
|
||||
A family of combinators for defining webservices APIs and serving them
|
||||
|
@ -86,31 +86,27 @@ library
|
|||
build-depends:
|
||||
base >= 4.9 && < 4.13
|
||||
, bytestring >= 0.10.8.1 && < 0.11
|
||||
, mtl >= 2.1 && < 2.3
|
||||
, transformers >= 0.3.0.0 && < 0.6
|
||||
, mtl >= 2.2.2 && < 2.3
|
||||
, transformers >= 0.5.2.0 && < 0.6
|
||||
, 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.
|
||||
-- Here can be exceptions if we really need features from the newer versions.
|
||||
build-depends:
|
||||
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
|
||||
, bifunctors >= 5.5.3 && < 5.6
|
||||
, case-insensitive >= 1.2.0.11 && < 1.3
|
||||
, http-api-data >= 0.3.8.1 && < 0.4
|
||||
, http-media >= 0.7.1.2 && < 0.8
|
||||
, http-types >= 0.12.1 && < 0.13
|
||||
, http-api-data >= 0.3.10 && < 0.4
|
||||
, http-media >= 0.7.1.3 && < 0.8
|
||||
, http-types >= 0.12.2 && < 0.13
|
||||
, mmorph >= 1.1.2 && < 1.2
|
||||
, network-uri >= 2.6.1.0 && < 2.7
|
||||
, singleton-bool >= 0.1.4 && < 0.2
|
||||
, string-conversions >= 0.4.0.1 && < 0.5
|
||||
, tagged >= 0.8.5 && < 0.9
|
||||
, vault >= 0.3.1.1 && < 0.4
|
||||
, tagged >= 0.8.6 && < 0.9
|
||||
, vault >= 0.3.1.2 && < 0.4
|
||||
|
||||
hs-source-dirs: src
|
||||
default-language: Haskell2010
|
||||
|
@ -161,13 +157,12 @@ test-suite spec
|
|||
|
||||
-- Additonal dependencies
|
||||
build-depends:
|
||||
aeson-compat >= 0.3.8 && < 0.4
|
||||
, hspec >= 2.5.4 && < 2.6
|
||||
hspec >= 2.6.0 && < 2.7
|
||||
, QuickCheck >= 2.12.6.1 && < 2.13
|
||||
, quickcheck-instances >= 0.3.19 && < 0.4
|
||||
|
||||
build-tool-depends:
|
||||
hspec-discover:hspec-discover >= 2.5.4 && < 2.6
|
||||
hspec-discover:hspec-discover >= 2.6.0 && < 2.7
|
||||
|
||||
test-suite doctests
|
||||
build-depends:
|
||||
|
@ -177,7 +172,7 @@ test-suite doctests
|
|||
|
||||
-- We test Links failure with doctest, so we need extra dependencies
|
||||
build-depends:
|
||||
hspec >= 2.5.4 && < 2.6
|
||||
hspec >= 2.6.0 && < 2.7
|
||||
|
||||
type: exitcode-stdio-1.0
|
||||
main-is: test/doctests.hs
|
||||
|
|
|
@ -10,7 +10,8 @@ module Servant.API.ContentTypesSpec where
|
|||
import Prelude ()
|
||||
import Prelude.Compat
|
||||
|
||||
import Data.Aeson.Compat
|
||||
import Data.Aeson
|
||||
(FromJSON, ToJSON (..), Value, decode, encode, object, (.=))
|
||||
import Data.ByteString.Char8
|
||||
(ByteString, append, pack)
|
||||
import qualified Data.ByteString.Lazy as BSL
|
||||
|
|
18
stack.yaml
18
stack.yaml
|
@ -16,10 +16,18 @@ packages:
|
|||
# - doc/tutorial/
|
||||
|
||||
extra-deps:
|
||||
- base-compat-0.10.5
|
||||
- conduit-1.3.1
|
||||
- generics-sop-0.4.0.1
|
||||
- sop-core-0.4.0.0
|
||||
- QuickCheck-2.12.6.1
|
||||
- hspec-2.6.0
|
||||
- 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
|
||||
- hspec-2.5.8
|
||||
- hspec-core-2.5.8
|
||||
- hspec-discover-2.5.8
|
||||
- pipes-safe-2.3.1
|
||||
- QuickCheck-2.12.6.1
|
||||
- resourcet-1.2.2
|
||||
- sop-core-0.4.0.0
|
||||
- wai-extra-3.0.24.3
|
||||
- tasty-1.1.0.4
|
||||
|
|
Loading…
Reference in a new issue