summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorInari Listenmaa <inari.listenmaa@gmail.com>2022-10-04 16:59:53 +0200
committerGitHub <noreply@github.com>2022-10-04 16:59:53 +0200
commit3122590e351f769ca6e60dfd4eeaafba1c5c22e8 (patch)
treeffa268d361530d907133f6aa8271f75b4b9cab19 /src
parent223f92d4f67bc4a168409b20e019b0ec6ad4b904 (diff)
parent0a16b76875fa8d99c81a4e840083faff771b3cda (diff)
Merge pull request #148 from anka-213/fix-ghc-7.10-build
Fix ghc-7.10 build
Diffstat (limited to 'src')
-rw-r--r--src/compiler/GF/Interactive.hs4
-rw-r--r--src/tools/c/GFCC/ErrM.hs9
2 files changed, 12 insertions, 1 deletions
diff --git a/src/compiler/GF/Interactive.hs b/src/compiler/GF/Interactive.hs
index 676511680..1970533d6 100644
--- a/src/compiler/GF/Interactive.hs
+++ b/src/compiler/GF/Interactive.hs
@@ -38,6 +38,10 @@ import GF.Server(server)
#endif
import GF.Command.Messages(welcome)
+#if !(MIN_VERSION_base(4,9,0))
+-- Needed to make it compile on GHC < 8
+import Control.Monad.Trans.Instances ()
+#endif
-- | Run the GF Shell in quiet mode (@gf -run@).
mainRunGFI :: Options -> [FilePath] -> IO ()
diff --git a/src/tools/c/GFCC/ErrM.hs b/src/tools/c/GFCC/ErrM.hs
index 78295d30e..872a8aec0 100644
--- a/src/tools/c/GFCC/ErrM.hs
+++ b/src/tools/c/GFCC/ErrM.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE DeriveFunctor #-}
-- BNF Converter: Error Monad
-- Copyright (C) 2004 Author: Aarne Ranta
@@ -6,12 +8,17 @@ module GFCC.ErrM where
-- Control.Monad.Fail import will become redundant in GHC 8.8+
import qualified Control.Monad.Fail as Fail
+import Control.Monad (ap)
-- the Error monad: like Maybe type with error msgs
data Err a = Ok a | Bad String
- deriving (Read, Show, Eq)
+ deriving (Read, Show, Eq, Functor)
+
+instance Applicative Err where
+ pure = Ok
+ (<*>) = ap
instance Monad Err where
return = Ok