summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorkrangelov <kr.angelov@gmail.com>2020-10-02 19:55:24 +0200
committerkrangelov <kr.angelov@gmail.com>2020-10-02 19:55:24 +0200
commitf3a8658cc1ed5b2721ee9d3f670f6b9a49f0f049 (patch)
tree8a311ec3c3a454088fa3c74b4464f974fe5aee21 /src/tools
parentbfb94d1e48fded159bbf63a992564cb24e987772 (diff)
parentf56fbcf86e472262d07c6bd713f6955cfbcfee8a (diff)
Merge branch 'master' of https://github.com/GrammaticalFramework/gf-core
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/c/GFCC/ErrM.hs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/tools/c/GFCC/ErrM.hs b/src/tools/c/GFCC/ErrM.hs
index 820473ccd..78295d30e 100644
--- a/src/tools/c/GFCC/ErrM.hs
+++ b/src/tools/c/GFCC/ErrM.hs
@@ -4,6 +4,10 @@
-- This file comes with NO WARRANTY and may be used FOR ANY PURPOSE.
module GFCC.ErrM where
+-- Control.Monad.Fail import will become redundant in GHC 8.8+
+import qualified Control.Monad.Fail as Fail
+
+
-- the Error monad: like Maybe type with error msgs
data Err a = Ok a | Bad String
@@ -11,6 +15,13 @@ data Err a = Ok a | Bad String
instance Monad Err where
return = Ok
- fail = Bad
Ok a >>= f = f a
Bad s >>= f = Bad s
+
+#if !(MIN_VERSION_base(4,13,0))
+ fail = Bad
+#endif
+
+instance Fail.MonadFail Err where
+ fail = Bad
+