mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 03:32:51 -06:00
First attempt at fixing incompabilities with newer cabal
This commit is contained in:
1
Setup.hs
1
Setup.hs
@@ -19,7 +19,6 @@ main = defaultMainWithHooks simpleUserHooks
|
|||||||
, preInst = gfPreInst
|
, preInst = gfPreInst
|
||||||
, postInst = gfPostInst
|
, postInst = gfPostInst
|
||||||
, postCopy = gfPostCopy
|
, postCopy = gfPostCopy
|
||||||
, sDistHook = gfSDist
|
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
gfPreBuild args = gfPre args . buildDistPref
|
gfPreBuild args = gfPre args . buildDistPref
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ import GF.Text.Pretty
|
|||||||
import Data.List (nub, (\\), tails)
|
import Data.List (nub, (\\), tails)
|
||||||
import qualified Data.IntMap as IntMap
|
import qualified Data.IntMap as IntMap
|
||||||
import Data.Maybe(fromMaybe,isNothing)
|
import Data.Maybe(fromMaybe,isNothing)
|
||||||
|
#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
|
||||||
|
|
||||||
checkLType :: GlobalEnv -> Term -> Type -> Check (Term, Type)
|
checkLType :: GlobalEnv -> Term -> Type -> Check (Term, Type)
|
||||||
checkLType ge t ty = runTcM $ do
|
checkLType ge t ty = runTcM $ do
|
||||||
@@ -646,7 +650,18 @@ instance Monad TcM where
|
|||||||
f >>= g = TcM (\ms msgs -> case unTcM f ms msgs of
|
f >>= g = TcM (\ms msgs -> case unTcM f ms msgs of
|
||||||
TcOk x ms msgs -> unTcM (g x) ms msgs
|
TcOk x ms msgs -> unTcM (g x) ms msgs
|
||||||
TcFail msgs -> TcFail msgs)
|
TcFail msgs -> TcFail msgs)
|
||||||
|
|
||||||
|
#if !(MIN_VERSION_base(4,13,0))
|
||||||
fail = tcError . pp
|
fail = tcError . pp
|
||||||
|
#endif
|
||||||
|
|
||||||
|
instance Fail.MonadFail TcM where
|
||||||
|
fail = tcError . pp
|
||||||
|
|
||||||
|
|
||||||
|
-- Control.Monad.Fail import will become redundant in GHC 8.8+
|
||||||
|
import qualified Control.Monad.Fail as Fail
|
||||||
|
|
||||||
|
|
||||||
instance Applicative TcM where
|
instance Applicative TcM where
|
||||||
pure = return
|
pure = return
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ module GF.Data.ErrM where
|
|||||||
|
|
||||||
import Control.Monad (MonadPlus(..),ap)
|
import Control.Monad (MonadPlus(..),ap)
|
||||||
import Control.Applicative
|
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
|
-- | Like 'Maybe' type with error msgs
|
||||||
data Err a = Ok a | Bad String
|
data Err a = Ok a | Bad String
|
||||||
@@ -33,10 +37,23 @@ fromErr a = err (const a) id
|
|||||||
|
|
||||||
instance Monad Err where
|
instance Monad Err where
|
||||||
return = Ok
|
return = Ok
|
||||||
fail = Bad
|
|
||||||
Ok a >>= f = f a
|
Ok a >>= f = f a
|
||||||
Bad s >>= f = Bad s
|
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
|
-- | added 2\/10\/2003 by PEB
|
||||||
instance Functor Err where
|
instance Functor Err where
|
||||||
fmap f (Ok a) = Ok (f a)
|
fmap f (Ok a) = Ok (f a)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
-- -*- haskell -*-
|
-- -*- haskell -*-
|
||||||
{
|
{
|
||||||
|
{-# LANGUAGE CPP #-}
|
||||||
module GF.Grammar.Lexer
|
module GF.Grammar.Lexer
|
||||||
( Token(..), Posn(..)
|
( Token(..), Posn(..)
|
||||||
, P, runP, runPartial, token, lexer, getPosn, failLoc
|
, P, runP, runPartial, token, lexer, getPosn, failLoc
|
||||||
@@ -18,6 +19,9 @@ import qualified Data.Map as Map
|
|||||||
import Data.Word(Word8)
|
import Data.Word(Word8)
|
||||||
import Data.Char(readLitChar)
|
import Data.Char(readLitChar)
|
||||||
--import Debug.Trace(trace)
|
--import Debug.Trace(trace)
|
||||||
|
|
||||||
|
-- Control.Monad.Fail import will become redundant in GHC 8.8+
|
||||||
|
import qualified Control.Monad.Fail as Fail
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -282,7 +286,16 @@ instance Monad P where
|
|||||||
(P m) >>= k = P $ \ s -> case m s of
|
(P m) >>= k = P $ \ s -> case m s of
|
||||||
POk s a -> unP (k a) s
|
POk s a -> unP (k a) s
|
||||||
PFailed posn err -> PFailed posn err
|
PFailed posn err -> PFailed posn err
|
||||||
|
|
||||||
|
#if !(MIN_VERSION_base(4,13,0))
|
||||||
fail msg = P $ \(_,AI posn _ _) -> PFailed posn msg
|
fail msg = P $ \(_,AI posn _ _) -> PFailed posn msg
|
||||||
|
#endif
|
||||||
|
|
||||||
|
instance Fail.MonadFail P where
|
||||||
|
fail msg = P $ \(_,AI posn _ _) -> PFailed posn msg
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
runP :: P a -> BS.ByteString -> Either (Posn,String) a
|
runP :: P a -> BS.ByteString -> Either (Posn,String) a
|
||||||
runP p bs = snd <$> runP' p (Pn 1 0,bs)
|
runP p bs = snd <$> runP' p (Pn 1 0,bs)
|
||||||
|
|||||||
@@ -159,6 +159,9 @@ instance ErrorMonad IO where
|
|||||||
then h (ioeGetErrorString e)
|
then h (ioeGetErrorString e)
|
||||||
else ioError e
|
else ioError e
|
||||||
{-
|
{-
|
||||||
|
-- Control.Monad.Fail import will become redundant in GHC 8.8+
|
||||||
|
import qualified Control.Monad.Fail as Fail
|
||||||
|
|
||||||
instance Functor IOE where fmap = liftM
|
instance Functor IOE where fmap = liftM
|
||||||
|
|
||||||
instance Applicative IOE where
|
instance Applicative IOE where
|
||||||
@@ -170,7 +173,15 @@ instance Monad IOE where
|
|||||||
IOE c >>= f = IOE $ do
|
IOE c >>= f = IOE $ do
|
||||||
x <- c -- Err a
|
x <- c -- Err a
|
||||||
appIOE $ err raise f x -- f :: a -> IOE a
|
appIOE $ err raise f x -- f :: a -> IOE a
|
||||||
|
|
||||||
|
#if !(MIN_VERSION_base(4,13,0))
|
||||||
fail = raise
|
fail = raise
|
||||||
|
#endif
|
||||||
|
|
||||||
|
instance Fail.MonadFail IOE where
|
||||||
|
fail = raise
|
||||||
|
|
||||||
|
|
||||||
-}
|
-}
|
||||||
|
|
||||||
-- | Print the error message and return a default value if the IO operation 'fail's
|
-- | Print the error message and return a default value if the IO operation 'fail's
|
||||||
|
|||||||
@@ -101,6 +101,10 @@ import GHC.Word
|
|||||||
--import GHC.Int
|
--import GHC.Int
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
-- Control.Monad.Fail import will become redundant in GHC 8.8+
|
||||||
|
import qualified Control.Monad.Fail as Fail
|
||||||
|
|
||||||
|
|
||||||
-- | The parse state
|
-- | The parse state
|
||||||
data S = S {-# UNPACK #-} !B.ByteString -- current chunk
|
data S = S {-# UNPACK #-} !B.ByteString -- current chunk
|
||||||
L.ByteString -- the rest of the input
|
L.ByteString -- the rest of the input
|
||||||
@@ -126,6 +130,11 @@ instance Monad Get where
|
|||||||
(a, s') -> unGet (k a) s')
|
(a, s') -> unGet (k a) s')
|
||||||
{-# INLINE (>>=) #-}
|
{-# INLINE (>>=) #-}
|
||||||
|
|
||||||
|
#if !(MIN_VERSION_base(4,13,0))
|
||||||
|
fail = failDesc
|
||||||
|
#endif
|
||||||
|
|
||||||
|
instance Fail.MonadFail Get where
|
||||||
fail = failDesc
|
fail = failDesc
|
||||||
|
|
||||||
instance MonadFix Get where
|
instance MonadFix Get where
|
||||||
|
|||||||
@@ -4,6 +4,10 @@
|
|||||||
-- This file comes with NO WARRANTY and may be used FOR ANY PURPOSE.
|
-- This file comes with NO WARRANTY and may be used FOR ANY PURPOSE.
|
||||||
module GFCC.ErrM where
|
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
|
-- the Error monad: like Maybe type with error msgs
|
||||||
|
|
||||||
data Err a = Ok a | Bad String
|
data Err a = Ok a | Bad String
|
||||||
@@ -11,6 +15,13 @@ data Err a = Ok a | Bad String
|
|||||||
|
|
||||||
instance Monad Err where
|
instance Monad Err where
|
||||||
return = Ok
|
return = Ok
|
||||||
fail = Bad
|
|
||||||
Ok a >>= f = f a
|
Ok a >>= f = f a
|
||||||
Bad s >>= f = Bad s
|
Bad s >>= f = Bad s
|
||||||
|
|
||||||
|
#if !(MIN_VERSION_base(4,13,0))
|
||||||
|
fail = Bad
|
||||||
|
#endif
|
||||||
|
|
||||||
|
instance Fail.MonadFail Err where
|
||||||
|
fail = Bad
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user