diff --git a/servant-auth/servant-auth-client/servant-auth-client.cabal b/servant-auth/servant-auth-client/servant-auth-client.cabal index 02092fec..c1ebfc08 100644 --- a/servant-auth/servant-auth-client/servant-auth-client.cabal +++ b/servant-auth/servant-auth-client/servant-auth-client.cabal @@ -74,7 +74,7 @@ test-suite spec , transformers >= 0.4.2.0 && < 0.6 , wai >= 3.2.1.2 && < 3.3 , warp >= 3.2.25 && < 3.4 - , jose >= 0.7.0.0 && < 0.10 + , jose >= 0.10 && < 0.11 other-modules: Servant.Auth.ClientSpec default-language: Haskell2010 diff --git a/servant-auth/servant-auth-server/servant-auth-server.cabal b/servant-auth/servant-auth-server/servant-auth-server.cabal index 00535d30..b3fc096e 100644 --- a/servant-auth/servant-auth-server/servant-auth-server.cabal +++ b/servant-auth/servant-auth-server/servant-auth-server.cabal @@ -41,11 +41,11 @@ library , data-default-class >= 0.1.2.0 && < 0.2 , entropy >= 0.4.1.3 && < 0.5 , http-types >= 0.12.2 && < 0.13 - , jose >= 0.7.0.0 && < 0.10 + , jose >= 0.10 && < 0.11 , lens >= 4.16.1 && < 5.3 , memory >= 0.14.16 && < 0.19 , monad-time >= 0.3.1.0 && < 0.4 - , mtl >= 2.2.2 && < 2.3 + , mtl ^>= 2.2.2 || ^>= 2.3.1 , servant >= 0.13 && < 0.20 , servant-auth == 0.4.* , servant-server >= 0.13 && < 0.20 diff --git a/servant-auth/servant-auth-server/src/Servant/Auth/Server/Internal/Cookie.hs b/servant-auth/servant-auth-server/src/Servant/Auth/Server/Internal/Cookie.hs index a91b42de..6908fc22 100644 --- a/servant-auth/servant-auth-server/src/Servant/Auth/Server/Internal/Cookie.hs +++ b/servant-auth/servant-auth-server/src/Servant/Auth/Server/Internal/Cookie.hs @@ -2,6 +2,7 @@ module Servant.Auth.Server.Internal.Cookie where import Blaze.ByteString.Builder (toByteString) +import Control.Monad (MonadPlus(..), guard) import Control.Monad.Except import Control.Monad.Reader import qualified Crypto.JOSE as Jose diff --git a/servant-auth/servant-auth-server/src/Servant/Auth/Server/Internal/JWT.hs b/servant-auth/servant-auth-server/src/Servant/Auth/Server/Internal/JWT.hs index 0c8c3c54..5412fdcd 100644 --- a/servant-auth/servant-auth-server/src/Servant/Auth/Server/Internal/JWT.hs +++ b/servant-auth/servant-auth-server/src/Servant/Auth/Server/Internal/JWT.hs @@ -1,18 +1,14 @@ module Servant.Auth.Server.Internal.JWT where import Control.Lens -import Control.Monad.Except +import Control.Monad (MonadPlus(..), guard) import Control.Monad.Reader import qualified Crypto.JOSE as Jose import qualified Crypto.JWT as Jose -import Data.Aeson (FromJSON, Result (..), ToJSON, fromJSON, - toJSON) import Data.ByteArray (constEq) import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy as BSL -import qualified Data.HashMap.Strict as HM import Data.Maybe (fromMaybe) -import qualified Data.Text as T import Data.Time (UTCTime) import Network.Wai (requestHeaders) @@ -42,7 +38,7 @@ jwtAuthCheck jwtSettings = do -- token expires. makeJWT :: ToJWT a => a -> JWTSettings -> Maybe UTCTime -> IO (Either Jose.Error BSL.ByteString) -makeJWT v cfg expiry = runExceptT $ do +makeJWT v cfg expiry = Jose.runJOSE $ do bestAlg <- Jose.bestJWSAlg $ signingKey cfg let alg = fromMaybe bestAlg $ jwtAlg cfg ejwt <- Jose.signClaims (signingKey cfg) @@ -59,7 +55,7 @@ makeJWT v cfg expiry = runExceptT $ do verifyJWT :: FromJWT a => JWTSettings -> BS.ByteString -> IO (Maybe a) verifyJWT jwtCfg input = do keys <- validationKeys jwtCfg - verifiedJWT <- runExceptT $ do + verifiedJWT <- Jose.runJOSE $ do unverifiedJWT <- Jose.decodeCompact (BSL.fromStrict input) Jose.verifyClaims (jwtSettingsToJwtValidationSettings jwtCfg) diff --git a/servant-auth/servant-auth-server/src/Servant/Auth/Server/Internal/Types.hs b/servant-auth/servant-auth-server/src/Servant/Auth/Server/Internal/Types.hs index 8e9e91f1..7d4c8697 100644 --- a/servant-auth/servant-auth-server/src/Servant/Auth/Server/Internal/Types.hs +++ b/servant-auth/servant-auth-server/src/Servant/Auth/Server/Internal/Types.hs @@ -2,6 +2,7 @@ module Servant.Auth.Server.Internal.Types where import Control.Applicative +import Control.Monad (MonadPlus(..), ap) import Control.Monad.Reader import Control.Monad.Time import Data.Monoid (Monoid (..)) diff --git a/servant-auth/servant-auth-server/test/Servant/Auth/ServerSpec.hs b/servant-auth/servant-auth-server/test/Servant/Auth/ServerSpec.hs index 1810e64d..1b13993b 100644 --- a/servant-auth/servant-auth-server/test/Servant/Auth/ServerSpec.hs +++ b/servant-auth/servant-auth-server/test/Servant/Auth/ServerSpec.hs @@ -6,13 +6,12 @@ module Servant.Auth.ServerSpec (spec) where #endif import Control.Lens -import Control.Monad.Except (runExceptT) import Control.Monad.IO.Class (liftIO) import Crypto.JOSE (Alg (HS256, None), Error, JWK, JWSHeader, KeyMaterialGenParam (OctGenParam), ToCompact, encodeCompact, - genJWK, newJWSHeader) + genJWK, newJWSHeader, runJOSE) import Crypto.JWT (Audience (..), ClaimsSet, NumericDate (NumericDate), SignedJWT, @@ -540,7 +539,7 @@ addJwtToHeader jwt = case jwt of $ defaults & header "Authorization" .~ ["Bearer " <> BSL.toStrict v] createJWT :: JWK -> JWSHeader () -> ClaimsSet -> IO (Either Error Crypto.JWT.SignedJWT) -createJWT k a b = runExceptT $ signClaims k a b +createJWT k a b = runJOSE $ signClaims k a b addJwtToCookie :: ToCompact a => CookieSettings -> Either Error a -> IO Options addJwtToCookie ccfg jwt = case jwt >>= (return . encodeCompact) of diff --git a/servant-auth/servant-auth/servant-auth.cabal b/servant-auth/servant-auth/servant-auth.cabal index 79c8a396..d4f7fa70 100644 --- a/servant-auth/servant-auth/servant-auth.cabal +++ b/servant-auth/servant-auth/servant-auth.cabal @@ -36,7 +36,7 @@ library base >= 4.10 && < 4.18 , containers >= 0.6 && < 0.7 , aeson >= 1.3.1.1 && < 3 - , jose >= 0.7.0.0 && < 0.10 + , jose >= 0.10 && < 0.11 , lens >= 4.16.1 && < 5.3 , servant >= 0.15 && < 0.20 , text >= 1.2.3.0 && < 2.1 diff --git a/servant-client-core/servant-client-core.cabal b/servant-client-core/servant-client-core.cabal index 9994832d..1d15594f 100644 --- a/servant-client-core/servant-client-core.cabal +++ b/servant-client-core/servant-client-core.cabal @@ -56,7 +56,7 @@ library , containers >= 0.5.7.1 && < 0.7 , deepseq >= 1.4.2.0 && < 1.5 , text >= 1.2.3.0 && < 2.1 - , transformers >= 0.5.2.0 && < 0.6 + , transformers >= 0.5.2.0 && < 0.7 , template-haskell >= 2.11.1.0 && < 2.20 if !impl(ghc >= 8.2) diff --git a/servant-client-ghcjs/servant-client-ghcjs.cabal b/servant-client-ghcjs/servant-client-ghcjs.cabal index 26d3aa78..6e723326 100644 --- a/servant-client-ghcjs/servant-client-ghcjs.cabal +++ b/servant-client-ghcjs/servant-client-ghcjs.cabal @@ -48,7 +48,7 @@ library , http-media >=0.6.2 && <0.9 , http-types >=0.12 && <0.13 , monad-control >=1.0.0.4 && <1.1 - , mtl >=2.2.2 && <2.3 + , mtl ^>=2.2.2 || ^>=2.3.1 , semigroupoids >=5.3 && <5.4 , string-conversions >=0.3 && <0.5 , transformers >=0.3 && <0.6 diff --git a/servant-client/servant-client.cabal b/servant-client/servant-client.cabal index 8c0b51fe..2669f6d4 100644 --- a/servant-client/servant-client.cabal +++ b/servant-client/servant-client.cabal @@ -45,11 +45,11 @@ library , bytestring >= 0.10.8.1 && < 0.12 , containers >= 0.5.7.1 && < 0.7 , deepseq >= 1.4.2.0 && < 1.5 - , mtl >= 2.2.2 && < 2.3 + , mtl ^>= 2.2.2 || ^>= 2.3.1 , stm >= 2.4.5.1 && < 2.6 , text >= 1.2.3.0 && < 2.1 , time >= 1.6.0.1 && < 1.13 - , transformers >= 0.5.2.0 && < 0.6 + , transformers >= 0.5.2.0 && < 0.7 if !impl(ghc >= 8.2) build-depends: diff --git a/servant-client/src/Servant/Client/Internal/HttpClient/Streaming.hs b/servant-client/src/Servant/Client/Internal/HttpClient/Streaming.hs index 14fcb56d..41a06572 100644 --- a/servant-client/src/Servant/Client/Internal/HttpClient/Streaming.hs +++ b/servant-client/src/Servant/Client/Internal/HttpClient/Streaming.hs @@ -24,7 +24,8 @@ import Control.DeepSeq (NFData, force) import Control.Exception (evaluate, throwIO) -import Control.Monad () +import Control.Monad + (unless) import Control.Monad.Base (MonadBase (..)) import Control.Monad.Codensity diff --git a/servant-conduit/servant-conduit.cabal b/servant-conduit/servant-conduit.cabal index e20ba9b0..2f530206 100644 --- a/servant-conduit/servant-conduit.cabal +++ b/servant-conduit/servant-conduit.cabal @@ -31,7 +31,7 @@ library base >=4.9 && <5 , bytestring >=0.10.8.1 && <0.12 , conduit >=1.3.1 && <1.4 - , mtl >=2.2.2 && <2.3 + , mtl ^>=2.2.2 || ^>=2.3.1 , resourcet >=1.2.2 && <1.3 , servant >=0.15 && <0.20 , unliftio-core >=0.1.2.0 && <0.3 diff --git a/servant-http-streams/servant-http-streams.cabal b/servant-http-streams/servant-http-streams.cabal index 9ba10121..82b1c03a 100644 --- a/servant-http-streams/servant-http-streams.cabal +++ b/servant-http-streams/servant-http-streams.cabal @@ -42,10 +42,10 @@ library , bytestring >= 0.10.8.1 && < 0.12 , containers >= 0.5.7.1 && < 0.7 , deepseq >= 1.4.2.0 && < 1.5 - , mtl >= 2.2.2 && < 2.3 + , mtl ^>= 2.2.2 || ^>= 2.3.1 , text >= 1.2.3.0 && < 2.1 , time >= 1.6.0.1 && < 1.13 - , transformers >= 0.5.2.0 && < 0.6 + , transformers >= 0.5.2.0 && < 0.7 if !impl(ghc >= 8.2) build-depends: diff --git a/servant-machines/servant-machines.cabal b/servant-machines/servant-machines.cabal index ce335326..ecdb6c38 100644 --- a/servant-machines/servant-machines.cabal +++ b/servant-machines/servant-machines.cabal @@ -31,7 +31,7 @@ library base >=4.9 && <5 , bytestring >=0.10.8.1 && <0.12 , machines >=0.6.4 && <0.8 - , mtl >=2.2.2 && <2.3 + , mtl ^>=2.2.2 || ^>=2.3.1 , servant >=0.15 && <0.20 hs-source-dirs: src default-language: Haskell2010 diff --git a/servant-pipes/servant-pipes.cabal b/servant-pipes/servant-pipes.cabal index 8b5966b8..fbdecdad 100644 --- a/servant-pipes/servant-pipes.cabal +++ b/servant-pipes/servant-pipes.cabal @@ -32,7 +32,7 @@ library , bytestring >=0.10.8.1 && <0.12 , pipes >=4.3.9 && <4.4 , pipes-safe >=2.3.1 && <2.4 - , mtl >=2.2.2 && <2.3 + , mtl ^>=2.2.2 || ^>=2.3.1 , monad-control >=1.0.2.3 && <1.1 , servant >=0.15 && <0.20 hs-source-dirs: src diff --git a/servant-server/servant-server.cabal b/servant-server/servant-server.cabal index 5b61967c..15cba22c 100644 --- a/servant-server/servant-server.cabal +++ b/servant-server/servant-server.cabal @@ -64,9 +64,9 @@ library , bytestring >= 0.10.8.1 && < 0.12 , constraints >= 0.2 && < 0.14 , containers >= 0.5.7.1 && < 0.7 - , mtl >= 2.2.2 && < 2.3 + , mtl ^>= 2.2.2 || ^>= 2.3.1 , text >= 1.2.3.0 && < 2.1 - , transformers >= 0.5.2.0 && < 0.6 + , transformers >= 0.5.2.0 && < 0.7 , filepath >= 1.4.1.1 && < 1.5 -- Servant dependencies diff --git a/servant/servant.cabal b/servant/servant.cabal index 461cad47..a3dc401d 100644 --- a/servant/servant.cabal +++ b/servant/servant.cabal @@ -83,9 +83,9 @@ library base >= 4.9 && < 4.18 , bytestring >= 0.10.8.1 && < 0.12 , constraints >= 0.2 - , mtl >= 2.2.2 && < 2.3 + , mtl ^>= 2.2.2 || ^>= 2.3.1 , sop-core >= 0.4.0.0 && < 0.6 - , transformers >= 0.5.2.0 && < 0.6 + , transformers >= 0.5.2.0 && < 0.7 , text >= 1.2.3.0 && < 2.1 diff --git a/servant/src/Servant/Types/SourceT.hs b/servant/src/Servant/Types/SourceT.hs index 84cb4b6a..74b654f7 100644 --- a/servant/src/Servant/Types/SourceT.hs +++ b/servant/src/Servant/Types/SourceT.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE RankNTypes #-} @@ -154,8 +155,10 @@ instance (Applicative m, Show1 m, Show a) => Show (StepT m a) where -- | >>> lift [1,2,3] :: StepT [] Int -- Effect [Yield 1 Stop,Yield 2 Stop,Yield 3 Stop] -- +#if !MIN_VERSION_transformers(0,6,0) instance MonadTrans StepT where lift = Effect . fmap (`Yield` Stop) +#endif instance MFunctor StepT where hoist f = go where