summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Data
diff options
context:
space:
mode:
authorAndreas Källberg <anka.213@gmail.com>2020-08-05 16:20:35 +0200
committerAndreas Källberg <anka.213@gmail.com>2020-08-05 18:48:24 +0200
commit251845f83ea52965b5205fd231ffa2c87bb34de6 (patch)
tree66b22f4370f09b673a44607ed1b0cc1294a2f74e /src/compiler/GF/Data
parentdeddde953f9e9b71e35a80bb29af0ce81e1dc6d0 (diff)
First attempt at fixing incompabilities with newer cabal
Diffstat (limited to 'src/compiler/GF/Data')
-rw-r--r--src/compiler/GF/Data/ErrM.hs19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/compiler/GF/Data/ErrM.hs b/src/compiler/GF/Data/ErrM.hs
index 033c1efac..0cef54816 100644
--- a/src/compiler/GF/Data/ErrM.hs
+++ b/src/compiler/GF/Data/ErrM.hs
@@ -16,6 +16,10 @@ module GF.Data.ErrM where
import Control.Monad (MonadPlus(..),ap)
import Control.Applicative
+#if !MIN_VERSION_base(4,11,0)
+-- Control.Monad.Fail import is redundant since GHC 8.8.1
+import qualified Control.Monad.Fail as Fail
+#endif
-- | Like 'Maybe' type with error msgs
data Err a = Ok a | Bad String
@@ -33,10 +37,23 @@ fromErr a = err (const a) id
instance Monad Err where
return = Ok
- fail = Bad
Ok a >>= f = f a
Bad s >>= f = Bad s
+#if !(MIN_VERSION_base(4,11,0))
+ fail = Bad
+#endif
+
+instance Fail.MonadFail Err where
+ fail = Bad
+
+-- Control.Monad.Fail import will become redundant in GHC 8.8+
+import qualified Control.Monad.Fail as Fail
+
+
+
+
+
-- | added 2\/10\/2003 by PEB
instance Functor Err where
fmap f (Ok a) = Ok (f a)