From 655d80a5c4c9e03b9c1f249a8319b7ca71b454eb Mon Sep 17 00:00:00 2001 From: Ollie Charles Date: Thu, 19 Sep 2019 13:31:24 +0100 Subject: [PATCH 1/2] Support GHC 8.8 --- Aws/DynamoDb/Core.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Aws/DynamoDb/Core.hs b/Aws/DynamoDb/Core.hs index bfb8bec1..dd49cc2c 100644 --- a/Aws/DynamoDb/Core.hs +++ b/Aws/DynamoDb/Core.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} @@ -119,6 +120,9 @@ module Aws.DynamoDb.Core import Control.Applicative import qualified Control.Exception as C import Control.Monad +#if MIN_VERSION_base(4,9,0) +import qualified Control.Monad.Fail as Fail +#endif import Control.Monad.Trans import Control.Monad.Trans.Resource (throwM) import qualified Crypto.Hash as CH @@ -1250,8 +1254,16 @@ instance Monad Parser where {-# INLINE (>>=) #-} return a = Parser $ \_kf ks -> ks a {-# INLINE return #-} +#if !(MIN_VERSION_base(4,13,0)) fail msg = Parser $ \kf _ks -> kf msg {-# INLINE fail #-} +#endif + +#if MIN_VERSION_base(4,9,0) +instance Fail.MonadFail Parser where + fail msg = Parser $ \kf _ks -> kf msg + {-# INLINE fail #-} +#endif instance Functor Parser where fmap f m = Parser $ \kf ks -> let ks' a = ks (f a) From bf568a3f51b5c9102c4dccd6b3f49e9d8ab8140f Mon Sep 17 00:00:00 2001 From: Ollie Charles Date: Thu, 19 Sep 2019 13:34:31 +0100 Subject: [PATCH 2/2] Update Core.hs --- Aws/DynamoDb/Core.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Aws/DynamoDb/Core.hs b/Aws/DynamoDb/Core.hs index dd49cc2c..1c116d3a 100644 --- a/Aws/DynamoDb/Core.hs +++ b/Aws/DynamoDb/Core.hs @@ -1394,7 +1394,7 @@ parseAttr parseAttr k m = case M.lookup k m of Nothing -> fail ("Key " Sem.<> T.unpack k Sem.<> " not found") - Just (DMap dv) -> either (fail "...") return $ fromItem dv + Just (DMap dv) -> either (const (fail "...")) return $ fromItem dv _ -> fail ("Key " Sem.<> T.unpack k Sem.<> " is not a map!") -------------------------------------------------------------------------------