diff --git a/.travis.yml b/.travis.yml index fe71ae6d..15aa48a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -69,11 +69,11 @@ install: - rm -fv cabal.project cabal.project.local - "if [ $HCNUMVER -ge 70800 ]; then sed -i.bak 's/-- ghc-options:.*/ghc-options: -j2/' ${HOME}/.cabal/config; fi" - 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\" \"doc/cookbook/basic-auth\" \"doc/cookbook/curl-mock\" \"doc/cookbook/db-postgres-pool\" \"doc/cookbook/db-sqlite-simple\" \"doc/cookbook/file-upload\" \"doc/cookbook/generic\" \"doc/cookbook/https\" \"doc/cookbook/sentry\" \"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\" \"doc/cookbook/basic-auth\" \"doc/cookbook/curl-mock\" \"doc/cookbook/db-postgres-pool\" \"doc/cookbook/db-sqlite-simple\" \"doc/cookbook/file-upload\" \"doc/cookbook/generic\" \"doc/cookbook/https\" \"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-auth-server:http-types,servant-auth-server:servant-server,servant-js:base, servant-pagination:servant,servant-pagination:servant-server' >> 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 -- cookbook-basic-auth | grep -vw -- cookbook-curl-mock | grep -vw -- cookbook-db-postgres-pool | grep -vw -- cookbook-db-sqlite-simple | grep -vw -- cookbook-file-upload | grep -vw -- cookbook-generic | grep -vw -- cookbook-https | grep -vw -- cookbook-sentry | 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 -- cookbook-basic-auth | grep -vw -- cookbook-curl-mock | grep -vw -- cookbook-db-postgres-pool | grep -vw -- cookbook-db-sqlite-simple | grep -vw -- cookbook-file-upload | grep -vw -- cookbook-generic | grep -vw -- cookbook-https | 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.local || true - if [ -f "servant/configure.ac" ]; then @@ -121,6 +121,9 @@ install: - if [ -f "doc/cookbook/sentry/configure.ac" ]; then (cd "doc/cookbook/sentry" && autoreconf -i); fi + - if [ -f "doc/cookbook/testing/configure.ac" ]; then + (cd "doc/cookbook/testing" && autoreconf -i); + fi - if [ -f "doc/cookbook/structuring-apis/configure.ac" ]; then (cd "doc/cookbook/structuring-apis" && autoreconf -i); fi @@ -131,7 +134,7 @@ install: (cd "doc/cookbook/using-free-client" && autoreconf -i); fi - rm -f cabal.project.freeze - - rm -rf .ghc.environment.* "servant"/dist "servant-client"/dist "servant-client-core"/dist "servant-docs"/dist "servant-foreign"/dist "servant-server"/dist "doc/tutorial"/dist "doc/cookbook/basic-auth"/dist "doc/cookbook/curl-mock"/dist "doc/cookbook/db-postgres-pool"/dist "doc/cookbook/db-sqlite-simple"/dist "doc/cookbook/file-upload"/dist "doc/cookbook/generic"/dist "doc/cookbook/https"/dist "doc/cookbook/sentry"/dist "doc/cookbook/structuring-apis"/dist "doc/cookbook/using-custom-monad"/dist "doc/cookbook/using-free-client"/dist + - rm -rf .ghc.environment.* "servant"/dist "servant-client"/dist "servant-client-core"/dist "servant-docs"/dist "servant-foreign"/dist "servant-server"/dist "doc/tutorial"/dist "doc/cookbook/basic-auth"/dist "doc/cookbook/curl-mock"/dist "doc/cookbook/db-postgres-pool"/dist "doc/cookbook/db-sqlite-simple"/dist "doc/cookbook/file-upload"/dist "doc/cookbook/generic"/dist "doc/cookbook/https"/dist "doc/cookbook/sentry"/dist "doc/cookbook/testing"/dist "doc/cookbook/structuring-apis"/dist "doc/cookbook/using-custom-monad"/dist "doc/cookbook/using-free-client"/dist - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX) # Here starts the actual work to be performed for the package under test; @@ -145,11 +148,11 @@ script: - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/ - cd ${DISTDIR} || false - 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 cookbook-basic-auth-*/*.cabal cookbook-curl-mock-*/*.cabal cookbook-db-postgres-pool-*/*.cabal cookbook-db-sqlite-simple-*/*.cabal cookbook-file-upload-*/*.cabal cookbook-generic-*/*.cabal cookbook-https-*/*.cabal cookbook-sentry-*/*.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 cookbook-basic-auth-*/*.cabal cookbook-curl-mock-*/*.cabal cookbook-db-postgres-pool-*/*.cabal cookbook-db-sqlite-simple-*/*.cabal cookbook-file-upload-*/*.cabal cookbook-generic-*/*.cabal cookbook-https-*/*.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-auth-server:http-types,servant-auth-server:servant-server,servant-js:base, servant-pagination:servant,servant-pagination:servant-server' >> 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 -- cookbook-basic-auth | grep -vw -- cookbook-curl-mock | grep -vw -- cookbook-db-postgres-pool | grep -vw -- cookbook-db-sqlite-simple | grep -vw -- cookbook-file-upload | grep -vw -- cookbook-generic | grep -vw -- cookbook-https | grep -vw -- cookbook-sentry | 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 -- cookbook-basic-auth | grep -vw -- cookbook-curl-mock | grep -vw -- cookbook-db-postgres-pool | grep -vw -- cookbook-db-sqlite-simple | grep -vw -- cookbook-file-upload | grep -vw -- cookbook-generic | grep -vw -- cookbook-https | 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.local || true - echo -en 'travis_fold:end:unpack\\r' diff --git a/cabal.project b/cabal.project index d215b20b..2bb4bdd8 100644 --- a/cabal.project +++ b/cabal.project @@ -19,7 +19,7 @@ packages: servant/ -- doc/cookbook/jwt-and-basic-auth/ -- doc/cookbook/pagination doc/cookbook/sentry - -- doc/cookbook/testing + doc/cookbook/testing doc/cookbook/structuring-apis doc/cookbook/using-custom-monad doc/cookbook/using-free-client diff --git a/doc/cookbook/testing/Testing.lhs b/doc/cookbook/testing/Testing.lhs index a075a144..b59cbba0 100644 --- a/doc/cookbook/testing/Testing.lhs +++ b/doc/cookbook/testing/Testing.lhs @@ -41,6 +41,9 @@ This recipe starts with the following ingredients: ```haskell {-# LANGUAGE OverloadedStrings, TypeFamilies, DataKinds, DeriveGeneric, TypeOperators #-} +import Prelude () +import Prelude.Compat + import qualified Control.Concurrent as C import Control.Concurrent.MVar import Control.Exception (bracket) @@ -48,9 +51,9 @@ import Control.Lens hiding (Context) import Data.Aeson import Data.Aeson.Lens import qualified Data.HashMap.Strict as HM -import Data.Text +import Data.Text (Text, unpack) import GHC.Generics -import Network.HTTP.Client hiding (Proxy) +import Network.HTTP.Client hiding (Proxy) import Network.HTTP.Types import Network.Wai import qualified Network.Wai.Handler.Warp as Warp @@ -407,7 +410,7 @@ server :: IO (Server API) server = do mvar <- newMVar "" return $ (\x -> liftIO $ swapMVar mvar x) - :<|> (liftIO $ readMVar mvar >>= return . Prelude.length) + :<|> (liftIO $ readMVar mvar >>= return . length) :<|> (const $ return ()) ``` @@ -502,4 +505,4 @@ Lastly, if you want a broad overview of where your application fits in with regard to best practices, consider using `servant-quickcheck`. This program is available as a cabal project -[here](https://github.com/haskell-servant/servant/tree/master/doc/cookbook/testing). \ No newline at end of file +[here](https://github.com/haskell-servant/servant/tree/master/doc/cookbook/testing). diff --git a/doc/cookbook/testing/testing.cabal b/doc/cookbook/testing/testing.cabal index c70ef924..536bde8b 100644 --- a/doc/cookbook/testing/testing.cabal +++ b/doc/cookbook/testing/testing.cabal @@ -15,6 +15,7 @@ tested-with: GHC==8.0.2, GHC==8.2.2, GHC==8.4.4, GHC==8.6.1 executable cookbook-testing main-is: Testing.lhs build-depends: base == 4.* + , base-compat , text >= 1.2 , aeson >= 1.2 , lens-aeson diff --git a/servant-client-core/servant-client-core.cabal b/servant-client-core/servant-client-core.cabal index 645e3520..ab313f15 100644 --- a/servant-client-core/servant-client-core.cabal +++ b/servant-client-core/servant-client-core.cabal @@ -66,7 +66,7 @@ library , base64-bytestring >= 1.0.0.1 && < 1.1 , exceptions >= 0.10.0 && < 0.11 , free >= 5.0.2 && < 5.2 - , generics-sop >= 0.3.2.0 && < 0.4 + , 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 @@ -94,9 +94,9 @@ test-suite spec -- Additonal dependencies build-depends: - deepseq >= 1.3.0.2 && <1.5 - , hspec >= 2.4.1 && <2.6 - , QuickCheck >= 2.11.3 && < 2.12 + deepseq >= 1.3.0.2 && < 1.5 + , hspec >= 2.4.1 && < 2.6 + , QuickCheck >= 2.12.6.1 && < 2.13 build-tool-depends: hspec-discover:hspec-discover >= 2.5.1 && <2.6 diff --git a/servant-client/servant-client.cabal b/servant-client/servant-client.cabal index c89a008d..3ad04e2c 100644 --- a/servant-client/servant-client.cabal +++ b/servant-client/servant-client.cabal @@ -100,11 +100,11 @@ test-suite spec -- Additonal dependencies build-depends: - generics-sop >= 0.3.2.0 && < 0.4 - , hspec >= 2.5.1 && < 2.6 - , HUnit >= 1.6 && < 1.7 - , network >= 2.6.3.2 && < 2.8 - , QuickCheck >= 2.10.1 && < 2.12 + generics-sop >= 0.4.0.1 && < 0.5 + , hspec >= 2.5.1 && < 2.6 + , HUnit >= 1.6 && < 1.7 + , network >= 2.8.0.0 && < 2.9 + , QuickCheck >= 2.12.6.1 && < 2.13 , servant == 0.14.* , servant-server == 0.14.* diff --git a/servant-server/servant-server.cabal b/servant-server/servant-server.cabal index 47320adc..a214e41b 100644 --- a/servant-server/servant-server.cabal +++ b/servant-server/servant-server.cabal @@ -164,7 +164,7 @@ test-suite spec , directory >= 1.2.1.0 && < 1.4 , hspec >= 2.5.1 && < 2.6 , hspec-wai >= 0.9.0 && < 0.10 - , QuickCheck >= 2.11.3 && < 2.12 + , 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 diff --git a/servant/servant.cabal b/servant/servant.cabal index 0f1a2c9c..39a262d4 100644 --- a/servant/servant.cabal +++ b/servant/servant.cabal @@ -146,10 +146,10 @@ test-suite spec -- Additonal dependencies build-depends: - aeson-compat >= 0.3.8 && < 0.4 - , hspec >= 2.5.4 && < 2.6 - , QuickCheck >= 2.11.3 && < 2.12 - , quickcheck-instances >= 0.3.18 && < 0.4 + aeson-compat >= 0.3.8 && < 0.4 + , hspec >= 2.5.4 && < 2.6 + , 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 diff --git a/stack.yaml b/stack.yaml index bfa09df1..331205fb 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,5 +1,5 @@ # Let's try to keep resolver at the first day of the month -resolver: nightly-2018-07-08 +resolver: nightly-2018-09-28 # Last nightly with GHC-8.4.3 packages: - servant-client/ - servant-client-core/ @@ -10,3 +10,7 @@ packages: # allow-newer: true # ignores all bounds, that's a sledgehammer # - doc/tutorial/ + +extra-deps: +- generics-sop-0.4.0.1 +- sop-core-0.4.0.0