From 4bf043652d2efd2c8df06d7317427f2b0674050f Mon Sep 17 00:00:00 2001 From: Shestakov Alex Date: Mon, 18 Apr 2022 12:09:11 +0000 Subject: [PATCH] MonadFail upgrade to the modern base --- src/Aws/General.hs | 3 ++- src/Aws/SignatureV4.hs | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Aws/General.hs b/src/Aws/General.hs index b6f9648..f219b0d 100644 --- a/src/Aws/General.hs +++ b/src/Aws/General.hs @@ -64,6 +64,7 @@ module Aws.General import Control.Applicative import Control.DeepSeq import Control.Monad +import qualified Control.Monad.Fail as MF import Data.Aeson (ToJSON(..), FromJSON(..), withText) import qualified Data.Attoparsec.Text as AP @@ -89,7 +90,7 @@ import Text.Printf class AwsType a where toText :: (IsString b, Monoid b) => a -> b - parse :: (Monad m, P.CharParsing m) => m a + parse :: (MF.MonadFail m, P.CharParsing m) => m a fromText :: T.Text -> Either String a fromText = AP.parseOnly $ parse <* P.eof diff --git a/src/Aws/SignatureV4.hs b/src/Aws/SignatureV4.hs index e601b64..5411733 100644 --- a/src/Aws/SignatureV4.hs +++ b/src/Aws/SignatureV4.hs @@ -103,6 +103,7 @@ import Control.Applicative import Control.Arrow hiding (left) import Control.DeepSeq import Control.Monad.IO.Class +import qualified Control.Monad.Fail as MF import Crypto.Hash @@ -462,7 +463,7 @@ credentialScopeToText s = <> "/" <> toText (credentialScopeService s) <> "/" <> terminationString -parseCredentialScope :: (Monad m, P.CharParsing m) => m CredentialScope +parseCredentialScope :: (MF.MonadFail m, P.CharParsing m) => m CredentialScope parseCredentialScope = CredentialScope <$> time <*> (P.char '/' *> parseRegion) @@ -472,7 +473,7 @@ parseCredentialScope = CredentialScope time = do str <- P.count 8 P.digit case p credentialScopeDateFormat str of - Nothing -> fail $ "failed to parse credential scope date: " <> str + Nothing -> MF.fail $ "failed to parse credential scope date: " <> str Just t -> return t #if MIN_VERSION_time(1,5,0) p = parseTimeM True defaultTimeLocale