git.iko.soy/servant-quickcheck
on master help sign in
Support servant-server-0.18
commite6daf03c165871cc0cc4f346e15cadb049078117 authorMaxim Koltsov <kolmax94@gmail.com> dateThu 30 Jul 2020, 19:22 (6 years ago) parent7926ad6
3 files changed+13−3
cabal.project+2 servant-quickcheck.cabal+3−3 src/Servant/QuickCheck/Internal/QuickCheck.hs+8
cabal.project+2
@@ -1,2 +1,4 @@
11packages: .
22tests: true
3+
4+allow-newer: servant-blaze:servant
servant-quickcheck.cabal+3−3
@@ -49,9 +49,9 @@ library
4949 , pretty >=1.1 && <1.2
5050 , process >=1.2 && <1.7
5151 , QuickCheck >=2.7 && <2.15
52− , servant >=0.17 && <0.18
53− , servant-client >=0.17 && <0.18
54− , servant-server >=0.17 && <0.18
52+ , servant >=0.17 && <0.19
53+ , servant-client >=0.17 && <0.19
54+ , servant-server >=0.17 && <0.19
5555 , split >=0.2 && <0.3
5656 , string-conversions >=0.3 && <0.5
5757 , temporary >=1.2 && <1.4
src/Servant/QuickCheck/Internal/QuickCheck.hs+8
@@ -11,6 +11,9 @@ import Network.Wai.Handler.Warp (withApplication)
1111import Prelude.Compat
1212import Servant (Context (EmptyContext), HasServer,
1313 Server, serveWithContext)
14+#if MIN_VERSION_servant_server(0,18,0)
15+import Servant (DefaultErrorFormatters, ErrorFormatters, HasContextEntry, type (.++))
16+#endif
1417import Servant.Client (BaseUrl (..), Scheme (..))
1518import System.IO.Unsafe (unsafePerformIO)
1619import Test.Hspec (Expectation, expectationFailure)
@@ -37,8 +40,13 @@ withServantServer api = withServantServerAndContext api EmptyContext
3740-- application.
3841--
3942-- /Since 0.0.0.0/
43+#if MIN_VERSION_servant_server(0,18,0)
44+withServantServerAndContext :: (HasServer a ctx, HasContextEntry (ctx .++ DefaultErrorFormatters) ErrorFormatters)
45+ => Proxy a -> Context ctx -> IO (Server a) -> (BaseUrl -> IO r) -> IO r
46+#else
4047withServantServerAndContext :: HasServer a ctx
4148 => Proxy a -> Context ctx -> IO (Server a) -> (BaseUrl -> IO r) -> IO r
49+#endif
4250withServantServerAndContext api ctx server t
4351 = withApplication (return . serveWithContext api ctx =<< server) $ \port ->
4452 t (BaseUrl Http "localhost" port "")