diff --git a/lib/Servant/Ekg.hs b/lib/Servant/Ekg.hs index e08b736..3e4164a 100644 --- a/lib/Servant/Ekg.hs +++ b/lib/Servant/Ekg.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} @@ -160,3 +161,8 @@ instance ReflectMethod method => HasEndpoint (Verb method status cts a) where instance HasEndpoint (Raw) where getEndpoint _ _ = Just ([],"RAW") + +#if MIN_VERSION_servant(0,8,1) +instance HasEndpoint (sub :: *) => HasEndpoint (CaptureAll (h :: Symbol) a :> sub) where + getEndpoint _ = getEndpoint (Proxy :: Proxy sub) +#endif diff --git a/servant-ekg.cabal b/servant-ekg.cabal index f22138f..f57d037 100644 --- a/servant-ekg.cabal +++ b/servant-ekg.cabal @@ -17,9 +17,9 @@ source-repository HEAD library exposed-modules: Servant.Ekg hs-source-dirs: lib - build-depends: base >=4.7 && <4.9 + build-depends: base >=4.7 && < 4.10 , ekg-core - , servant > 0.5 && < 0.8 + , servant > 0.5 && < 0.9 , http-types , text , time diff --git a/test/Servant/EkgSpec.hs b/test/Servant/EkgSpec.hs index 5831625..5ee2f2b 100644 --- a/test/Servant/EkgSpec.hs +++ b/test/Servant/EkgSpec.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE OverlappingInstances #-} @@ -69,7 +70,11 @@ type TestApi = :<|> "greet" :> ReqBody '[JSON] Greet :> Post '[JSON] Greet -- DELETE /greet/:greetid +#if MIN_VERSION_servant(0,8,0) + :<|> "greet" :> Capture "greetid" Text :> Delete '[JSON] NoContent +#else :<|> "greet" :> Capture "greetid" Text :> Delete '[JSON] () +#endif testApi :: Proxy TestApi testApi = Proxy @@ -89,7 +94,11 @@ server = helloH :<|> postGreetH :<|> deleteGreetH postGreetH = return +#if MIN_VERSION_servant(0,8,0) + deleteGreetH _ = return NoContent +#else deleteGreetH _ = return () +#endif -- Turn the server into a WAI app. 'serve' is provided by servant, -- more precisely by the Servant.Server module.