From e78d9554df8f1afd0f558515d49fd909790e0fcc Mon Sep 17 00:00:00 2001 From: Michael Tolly Date: Thu, 29 Nov 2018 21:09:05 -0600 Subject: [PATCH] MonadFail instance for GHC 8.6 --- Graphics/PDF/Draw.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Graphics/PDF/Draw.hs b/Graphics/PDF/Draw.hs index eff9001..3e0c1fe 100644 --- a/Graphics/PDF/Draw.hs +++ b/Graphics/PDF/Draw.hs @@ -86,6 +86,9 @@ import Data.Maybe #if !MIN_VERSION_base(4,8,0) import Data.Monoid #endif +#if MIN_VERSION_base(4,11,0) +import qualified Control.Monad.Fail as Fail +#endif import qualified Data.Map.Strict as M import qualified Data.IntMap as IM @@ -186,6 +189,11 @@ instance Monad Draw where unDraw (f a) env return x = Draw $ \_env -> return x +#if MIN_VERSION_base(4,11,0) +instance Fail.MonadFail Draw where + fail s = Draw $ \_ -> Fail.fail s +#endif + instance MonadReader DrawEnvironment Draw where ask = Draw $ \env -> return (drawEnvironment env) local f m = Draw $ \env -> let drawenv' = f (drawEnvironment env)