From 781ea66a623a07625976060517855d6ce8d7f4ae Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Mon, 23 Oct 2017 08:57:56 +0300 Subject: [PATCH 1/4] Use http-types-0.10 in stack.yaml --- stack.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stack.yaml b/stack.yaml index e283f7fd..5ca3446a 100644 --- a/stack.yaml +++ b/stack.yaml @@ -10,7 +10,8 @@ packages: extra-deps: - aeson-1.2.0.0 - attoparsec-iso8601-1.0.0.0 -- http-media-0.7.0 - cabal-doctest-1.0.2 - http-api-data-0.3.7 +- http-media-0.7.0 +- http-types-0.10 - servant-js-0.9.3 From 2d6bf5055bd341fad6ed48e8dd56c2e0c833fb26 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Sun, 22 Oct 2017 14:13:18 +0300 Subject: [PATCH 2/4] Improve .cabal files - Add build-tool-depends, so new-build can use hspec-discover - Add mtl bounds in tutorial (and dependency on mtl-compact) - Add extra-source-files to tutorial, so it's buildable from sdist --- doc/tutorial/tutorial.cabal | 13 ++++++++++++- servant-client-core/servant-client-core.cabal | 2 ++ servant-client/servant-client.cabal | 2 ++ servant-docs/servant-docs.cabal | 2 ++ servant-foreign/servant-foreign.cabal | 2 ++ servant-server/servant-server.cabal | 2 ++ servant/servant.cabal | 2 ++ 7 files changed, 24 insertions(+), 1 deletion(-) diff --git a/doc/tutorial/tutorial.cabal b/doc/tutorial/tutorial.cabal index 8c23a49d..ad886d01 100644 --- a/doc/tutorial/tutorial.cabal +++ b/doc/tutorial/tutorial.cabal @@ -8,6 +8,14 @@ author: Servant Contributors maintainer: haskell-servant-maintainers@googlegroups.com build-type: Simple cabal-version: >=1.10 +tested-with: + GHC==7.8.4 + GHC==7.10.3 + GHC==8.0.2 + GHC==8.2.1 +extra-source-files: + static/index.html + static/ui.js library exposed-modules: ApiType @@ -38,7 +46,8 @@ library , string-conversions , bytestring , attoparsec - , mtl + , mtl >=2.1 && <2.3 + , mtl-compat , random , js-jquery , wai @@ -57,6 +66,8 @@ test-suite spec hs-source-dirs: test main-is: Spec.hs other-modules: JavascriptSpec + build-tool-depends: + hspec-discover:hspec-discover build-depends: base == 4.* , tutorial , hspec diff --git a/servant-client-core/servant-client-core.cabal b/servant-client-core/servant-client-core.cabal index b8c52753..0cf8fb90 100644 --- a/servant-client-core/servant-client-core.cabal +++ b/servant-client-core/servant-client-core.cabal @@ -70,5 +70,7 @@ test-suite spec , servant-client-core , hspec == 2.* , QuickCheck >= 2.7 && < 2.11 + build-tool-depends: + hspec-discover:hspec-discover other-modules: Servant.Client.Core.Internal.BaseUrlSpec diff --git a/servant-client/servant-client.cabal b/servant-client/servant-client.cabal index 14ea3ad2..1e5cf91f 100644 --- a/servant-client/servant-client.cabal +++ b/servant-client/servant-client.cabal @@ -64,6 +64,8 @@ test-suite spec default-language: Haskell2010 hs-source-dirs: test main-is: Spec.hs + build-tool-depends: + hspec-discover:hspec-discover other-modules: Servant.ClientSpec build-depends: diff --git a/servant-docs/servant-docs.cabal b/servant-docs/servant-docs.cabal index 56515712..e2ea0a4e 100644 --- a/servant-docs/servant-docs.cabal +++ b/servant-docs/servant-docs.cabal @@ -75,6 +75,8 @@ test-suite spec type: exitcode-stdio-1.0 main-is: Spec.hs other-modules: Servant.DocsSpec + build-tool-depends: + hspec-discover:hspec-discover hs-source-dirs: test ghc-options: -Wall build-depends: diff --git a/servant-foreign/servant-foreign.cabal b/servant-foreign/servant-foreign.cabal index 35b41a53..32839565 100644 --- a/servant-foreign/servant-foreign.cabal +++ b/servant-foreign/servant-foreign.cabal @@ -65,6 +65,8 @@ test-suite spec include-dirs: include main-is: Spec.hs other-modules: Servant.ForeignSpec + build-tool-depends: + hspec-discover:hspec-discover build-depends: base , hspec >= 2.1.8 , servant diff --git a/servant-server/servant-server.cabal b/servant-server/servant-server.cabal index efb8f29b..8a90a73a 100644 --- a/servant-server/servant-server.cabal +++ b/servant-server/servant-server.cabal @@ -120,6 +120,8 @@ test-suite spec Servant.Server.UsingContextSpec.TestCombinators Servant.ServerSpec Servant.Utils.StaticFilesSpec + build-tool-depends: + hspec-discover:hspec-discover build-depends: base == 4.* , base-compat diff --git a/servant/servant.cabal b/servant/servant.cabal index fbd4d714..fe779840 100644 --- a/servant/servant.cabal +++ b/servant/servant.cabal @@ -118,6 +118,8 @@ test-suite spec Servant.API.ResponseHeadersSpec Servant.Utils.LinksSpec Servant.Utils.EnterSpec + build-tool-depends: + hspec-discover:hspec-discover build-depends: base == 4.* , base-compat From 09485871f5109c0620bfd571998bacc80f7a5b63 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Mon, 23 Oct 2017 08:04:28 +0300 Subject: [PATCH 3/4] Adopt http-types-0.10 --- servant-server/test/Servant/ServerSpec.hs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/servant-server/test/Servant/ServerSpec.hs b/servant-server/test/Servant/ServerSpec.hs index 49bde8ca..f2d86785 100644 --- a/servant-server/test/Servant/ServerSpec.hs +++ b/servant-server/test/Servant/ServerSpec.hs @@ -33,7 +33,11 @@ import Network.HTTP.Types (Status (..), hAccept, hContentType, methodDelete, methodGet, methodHead, methodPatch, methodPost, methodPut, ok200, +#if MIN_VERSION_http_types(0,10,0) + imATeapot418, +#else imATeaPot418, +#endif parseQuery) import Network.Wai (Application, Request, requestHeaders, pathInfo, queryString, rawQueryString, @@ -70,6 +74,11 @@ import Servant.Server.Experimental.Auth import Servant.Server.Internal.Context (NamedContext(..)) +#if !MIN_VERSION_http_types(0,10,0) +imATeapot418 :: Status +imATeapot418 = imATeaPot418 +#endif + -- * comprehensive api test -- This declaration simply checks that all instances are in place. @@ -662,7 +671,7 @@ basicAuthApi = Proxy basicAuthServer :: Server BasicAuthAPI basicAuthServer = const (return jerry) :<|> - (Tagged $ \ _ respond -> respond $ responseLBS imATeaPot418 [] "") + (Tagged $ \ _ respond -> respond $ responseLBS imATeapot418 [] "") basicAuthContext :: Context '[ BasicAuthCheck () ] basicAuthContext = @@ -707,7 +716,7 @@ genAuthApi = Proxy genAuthServer :: Server GenAuthAPI genAuthServer = const (return tweety) - :<|> (Tagged $ \ _ respond -> respond $ responseLBS imATeaPot418 [] "") + :<|> (Tagged $ \ _ respond -> respond $ responseLBS imATeapot418 [] "") type instance AuthServerData (AuthProtect "auth") = () From 76616de60106b080c593c998a50ac76575e4e930 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Sun, 22 Oct 2017 12:29:29 +0300 Subject: [PATCH 4/4] Allow http-types-0.10 --- servant-client-core/servant-client-core.cabal | 2 +- servant-client/servant-client.cabal | 2 +- servant-server/servant-server.cabal | 2 +- servant/servant.cabal | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/servant-client-core/servant-client-core.cabal b/servant-client-core/servant-client-core.cabal index 0cf8fb90..71064142 100644 --- a/servant-client-core/servant-client-core.cabal +++ b/servant-client-core/servant-client-core.cabal @@ -43,7 +43,7 @@ library , generics-sop >= 0.1.0.0 && < 0.4 , http-api-data >= 0.3.6 && < 0.4 , http-media >= 0.6.2 && < 0.8 - , http-types >= 0.8.6 && < 0.10 + , http-types >= 0.8.6 && < 0.11 , mtl >= 2.1 && < 2.3 , network-uri >= 2.6 && < 2.7 , safe >= 0.3.9 && < 0.4 diff --git a/servant-client/servant-client.cabal b/servant-client/servant-client.cabal index 1e5cf91f..f9c0fe08 100644 --- a/servant-client/servant-client.cabal +++ b/servant-client/servant-client.cabal @@ -41,7 +41,7 @@ library , http-client >= 0.4.30 && < 0.6 , http-client-tls >= 0.2.2 && < 0.4 , http-media >= 0.6.2 && < 0.8 - , http-types >= 0.8.6 && < 0.10 + , http-types >= 0.8.6 && < 0.11 , exceptions >= 0.8 && < 0.9 , monad-control >= 1.0.0.4 && < 1.1 , mtl >= 2.1 && < 2.3 diff --git a/servant-server/servant-server.cabal b/servant-server/servant-server.cabal index 8a90a73a..6bd91476 100644 --- a/servant-server/servant-server.cabal +++ b/servant-server/servant-server.cabal @@ -60,7 +60,7 @@ library , containers >= 0.5 && < 0.6 , exceptions >= 0.8 && < 0.9 , http-api-data >= 0.3 && < 0.4 - , http-types >= 0.8 && < 0.10 + , http-types >= 0.8 && < 0.11 , network-uri >= 2.6 && < 2.7 , monad-control >= 1.0.0.4 && < 1.1 , mtl >= 2 && < 2.3 diff --git a/servant/servant.cabal b/servant/servant.cabal index fe779840..3b34c2d0 100644 --- a/servant/servant.cabal +++ b/servant/servant.cabal @@ -66,7 +66,7 @@ library , case-insensitive >= 1.2 && < 1.3 , http-api-data >= 0.3 && < 0.4 , http-media >= 0.4 && < 0.8 - , http-types >= 0.8 && < 0.10 + , http-types >= 0.8 && < 0.11 , natural-transformation >= 0.4 && < 0.5 , mtl >= 2.0 && < 2.3 , mmorph >= 1 && < 1.2