mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-24 03:52:50 -06:00
upgrade to GHC 6.10.2
This commit is contained in:
2
GF.cabal
2
GF.cabal
@@ -709,7 +709,7 @@ executable gf
|
|||||||
other-modules: GF.System.NoReadline
|
other-modules: GF.System.NoReadline
|
||||||
|
|
||||||
if flag(interrupt)
|
if flag(interrupt)
|
||||||
ghc-options: -DUSE_INTERRUPT
|
cpp-options: -DUSE_INTERRUPT
|
||||||
other-modules: GF.System.UseSignal
|
other-modules: GF.System.UseSignal
|
||||||
else
|
else
|
||||||
other-modules: GF.System.NoSignal
|
other-modules: GF.System.NoSignal
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ convert abs_defs cnc_defs cat_defs = getParserInfo (loop grammarEnv)
|
|||||||
srules = [
|
srules = [
|
||||||
(XRule id args res (map findLinType args) (findLinType res) term) |
|
(XRule id args res (map findLinType args) (findLinType res) term) |
|
||||||
(id, (ty,_)) <- abs_defs, let (args,res) = catSkeleton ty,
|
(id, (ty,_)) <- abs_defs, let (args,res) = catSkeleton ty,
|
||||||
term <- Map.lookup id cnc_defs]
|
term <- maybeToList (Map.lookup id cnc_defs)]
|
||||||
|
|
||||||
findLinType id = fromMaybe (error $ "No lincat for " ++ show id) (Map.lookup id cat_defs)
|
findLinType id = fromMaybe (error $ "No lincat for " ++ show id) (Map.lookup id cat_defs)
|
||||||
|
|
||||||
@@ -198,15 +198,15 @@ convertTerm cnc_defs selector (K (KP strs vars))((lbl_path,lin) : lins) =
|
|||||||
do projectHead lbl_path
|
do projectHead lbl_path
|
||||||
toks <- member (strs:[strs' | Alt strs' _ <- vars])
|
toks <- member (strs:[strs' | Alt strs' _ <- vars])
|
||||||
return ((lbl_path, map (Right . KS) toks ++ lin) : lins)
|
return ((lbl_path, map (Right . KS) toks ++ lin) : lins)
|
||||||
convertTerm cnc_defs selector (F id) lins = do term <- Map.lookup id cnc_defs
|
convertTerm cnc_defs selector (F id) lins = case Map.lookup id cnc_defs of
|
||||||
convertTerm cnc_defs selector term lins
|
Just term -> convertTerm cnc_defs selector term lins
|
||||||
convertTerm cnc_defs selector (W s t) ((lbl_path,lin) : lins) = do
|
Nothing -> mzero
|
||||||
|
convertTerm cnc_defs selector (W s t) ((lbl_path,lin) : lins) = do
|
||||||
ss <- case t of
|
ss <- case t of
|
||||||
R ss -> return ss
|
R ss -> return ss
|
||||||
F f -> do
|
F f -> case Map.lookup f cnc_defs of
|
||||||
t <- Map.lookup f cnc_defs
|
Just (R ss) -> return ss
|
||||||
case t of
|
_ -> mzero
|
||||||
R ss -> return ss
|
|
||||||
convertRec cnc_defs selector 0 [K (KS (s ++ s1)) | K (KS s1) <- ss] lbl_path lin lins
|
convertRec cnc_defs selector 0 [K (KS (s ++ s1)) | K (KS s1) <- ss] lbl_path lin lins
|
||||||
convertTerm cnc_defs selector x lins = error ("convertTerm ("++show x++")")
|
convertTerm cnc_defs selector x lins = error ("convertTerm ("++show x++")")
|
||||||
|
|
||||||
@@ -255,8 +255,9 @@ evalTerm cnc_defs path (R record) = case path of
|
|||||||
evalTerm cnc_defs path (P term sel) = do index <- evalTerm cnc_defs [] sel
|
evalTerm cnc_defs path (P term sel) = do index <- evalTerm cnc_defs [] sel
|
||||||
evalTerm cnc_defs (index:path) term
|
evalTerm cnc_defs (index:path) term
|
||||||
evalTerm cnc_defs path (FV terms) = member terms >>= evalTerm cnc_defs path
|
evalTerm cnc_defs path (FV terms) = member terms >>= evalTerm cnc_defs path
|
||||||
evalTerm cnc_defs path (F id) = do term <- Map.lookup id cnc_defs
|
evalTerm cnc_defs path (F id) = case Map.lookup id cnc_defs of
|
||||||
evalTerm cnc_defs path term
|
Just term -> evalTerm cnc_defs path term
|
||||||
|
Nothing -> mzero
|
||||||
evalTerm cnc_defs path x = error ("evalTerm ("++show x++")")
|
evalTerm cnc_defs path x = error ("evalTerm ("++show x++")")
|
||||||
|
|
||||||
unifyPType :: FIndex -> FPath -> Term -> CnvMonad FIndex
|
unifyPType :: FIndex -> FPath -> Term -> CnvMonad FIndex
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{-# OPTIONS -fbang-patterns -cpp #-}
|
{-# LANGUAGE BangPatterns, CPP #-}
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
-- |
|
-- |
|
||||||
-- Maintainer : Krasimir Angelov
|
-- Maintainer : Krasimir Angelov
|
||||||
@@ -50,7 +50,7 @@ convert abs_defs cnc_defs cat_defs =
|
|||||||
xrules = [
|
xrules = [
|
||||||
(XRule id args (0,res) (map findLinType args) (findLinType (0,res)) term) |
|
(XRule id args (0,res) (map findLinType args) (findLinType (0,res)) term) |
|
||||||
(id, (ty,_)) <- abs_defs, let (args,res) = typeSkeleton ty,
|
(id, (ty,_)) <- abs_defs, let (args,res) = typeSkeleton ty,
|
||||||
term <- Map.lookup id cnc_defs]
|
term <- maybeToList (Map.lookup id cnc_defs)]
|
||||||
|
|
||||||
findLinType (_,id) = fromMaybe (error $ "No lincat for " ++ show id) (Map.lookup id cat_defs)
|
findLinType (_,id) = fromMaybe (error $ "No lincat for " ++ show id) (Map.lookup id cat_defs)
|
||||||
|
|
||||||
@@ -139,15 +139,15 @@ convertTerm cnc_defs sel ctype (K (KS t)) ((lbl_path,lin) : lins) = return ((l
|
|||||||
convertTerm cnc_defs sel ctype (K (KP strs vars))((lbl_path,lin) : lins) =
|
convertTerm cnc_defs sel ctype (K (KP strs vars))((lbl_path,lin) : lins) =
|
||||||
do toks <- member (strs:[strs' | Alt strs' _ <- vars])
|
do toks <- member (strs:[strs' | Alt strs' _ <- vars])
|
||||||
return ((lbl_path, map (FSymTok . KS) toks ++ lin) : lins)
|
return ((lbl_path, map (FSymTok . KS) toks ++ lin) : lins)
|
||||||
convertTerm cnc_defs sel ctype (F id) lins = do term <- Map.lookup id cnc_defs
|
convertTerm cnc_defs sel ctype (F id) lins = case Map.lookup id cnc_defs of
|
||||||
convertTerm cnc_defs sel ctype term lins
|
Just term -> convertTerm cnc_defs sel ctype term lins
|
||||||
convertTerm cnc_defs sel ctype (W s t) ((lbl_path,lin) : lins) = do
|
Nothing -> mzero
|
||||||
|
convertTerm cnc_defs sel ctype (W s t) ((lbl_path,lin) : lins) = do
|
||||||
ss <- case t of
|
ss <- case t of
|
||||||
R ss -> return ss
|
R ss -> return ss
|
||||||
F f -> do
|
F f -> case Map.lookup f cnc_defs of
|
||||||
t <- Map.lookup f cnc_defs
|
Just (R ss) -> return ss
|
||||||
case t of
|
_ -> mzero
|
||||||
R ss -> return ss
|
|
||||||
convertRec cnc_defs sel ctype [K (KS (s ++ s1)) | K (KS s1) <- ss] lbl_path lin lins
|
convertRec cnc_defs sel ctype [K (KS (s ++ s1)) | K (KS s1) <- ss] lbl_path lin lins
|
||||||
convertTerm cnc_defs sel ctype x lins = error ("convertTerm ("++show x++")")
|
convertTerm cnc_defs sel ctype x lins = error ("convertTerm ("++show x++")")
|
||||||
|
|
||||||
@@ -202,8 +202,9 @@ evalTerm cnc_defs path (R record) = case path of
|
|||||||
evalTerm cnc_defs path (P term sel) = do index <- evalTerm cnc_defs [] sel
|
evalTerm cnc_defs path (P term sel) = do index <- evalTerm cnc_defs [] sel
|
||||||
evalTerm cnc_defs (index:path) term
|
evalTerm cnc_defs (index:path) term
|
||||||
evalTerm cnc_defs path (FV terms) = member terms >>= evalTerm cnc_defs path
|
evalTerm cnc_defs path (FV terms) = member terms >>= evalTerm cnc_defs path
|
||||||
evalTerm cnc_defs path (F id) = do term <- Map.lookup id cnc_defs
|
evalTerm cnc_defs path (F id) = case Map.lookup id cnc_defs of
|
||||||
evalTerm cnc_defs path term
|
Just term -> evalTerm cnc_defs path term
|
||||||
|
Nothing -> mzero
|
||||||
evalTerm cnc_defs path x = error ("evalTerm ("++show x++")")
|
evalTerm cnc_defs path x = error ("evalTerm ("++show x++")")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
module GF.System.UseSignal where
|
module GF.System.UseSignal where
|
||||||
|
|
||||||
import Control.Concurrent (myThreadId, killThread)
|
import Control.Concurrent (myThreadId, killThread)
|
||||||
import Control.Exception (Exception,catch)
|
import Control.Exception (SomeException,catch)
|
||||||
import Prelude hiding (catch)
|
import Prelude hiding (catch)
|
||||||
import System.IO
|
import System.IO
|
||||||
|
|
||||||
@@ -48,10 +48,10 @@ myIgnore = Ignore
|
|||||||
-- unsafeInterleaveIO etc.) the lazy computation will
|
-- unsafeInterleaveIO etc.) the lazy computation will
|
||||||
-- not be interruptible, as it will be performed
|
-- not be interruptible, as it will be performed
|
||||||
-- after the signal handler has been removed.
|
-- after the signal handler has been removed.
|
||||||
runInterruptibly :: IO a -> IO (Either Exception a)
|
runInterruptibly :: IO a -> IO (Either SomeException a)
|
||||||
runInterruptibly a =
|
runInterruptibly a =
|
||||||
do t <- myThreadId
|
do t <- myThreadId
|
||||||
oldH <- myInstallHandler (myCatch (print "Seek and Destroy" >> killThread t))
|
oldH <- myInstallHandler (myCatch (killThread t))
|
||||||
x <- p `catch` h
|
x <- p `catch` h
|
||||||
myInstallHandler oldH
|
myInstallHandler oldH
|
||||||
return x
|
return x
|
||||||
@@ -66,7 +66,7 @@ runInterruptibly_ = fmap (either (const ()) id) . runInterruptibly
|
|||||||
-- | Run an action with SIGINT blocked.
|
-- | Run an action with SIGINT blocked.
|
||||||
blockInterrupt :: IO a -> IO a
|
blockInterrupt :: IO a -> IO a
|
||||||
blockInterrupt a =
|
blockInterrupt a =
|
||||||
do oldH <- myInstallHandler Ignore
|
do oldH <- myInstallHandler myIgnore
|
||||||
x <- a
|
x <- a
|
||||||
myInstallHandler oldH
|
myInstallHandler oldH
|
||||||
return x
|
return x
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{-# OPTIONS -cpp #-}
|
{-# LANGUAGE ScopedTypeVariables, CPP #-}
|
||||||
module GFI (mainGFI,mainRunGFI) where
|
module GFI (mainGFI,mainRunGFI) where
|
||||||
|
|
||||||
import GF.Command.Interpreter
|
import GF.Command.Interpreter
|
||||||
@@ -190,7 +190,7 @@ importInEnv gfenv opts files
|
|||||||
tryGetLine = do
|
tryGetLine = do
|
||||||
res <- try getLine
|
res <- try getLine
|
||||||
case res of
|
case res of
|
||||||
Left e -> return "q"
|
Left (e :: SomeException) -> return "q"
|
||||||
Right l -> return l
|
Right l -> return l
|
||||||
|
|
||||||
welcome = unlines [
|
welcome = unlines [
|
||||||
@@ -251,7 +251,7 @@ wordCompletion gfenv line0 prefix0 p =
|
|||||||
Nothing -> ret ' ' []
|
Nothing -> ret ' ' []
|
||||||
Just state -> let compls = getCompletions state prefix
|
Just state -> let compls = getCompletions state prefix
|
||||||
in ret ' ' (map (encode gfenv) (Map.keys compls))
|
in ret ' ' (map (encode gfenv) (Map.keys compls))
|
||||||
Left _ -> ret ' ' []
|
Left (_ :: SomeException) -> ret ' ' []
|
||||||
CmplOpt (Just (Command n _ _)) pref
|
CmplOpt (Just (Command n _ _)) pref
|
||||||
-> case Map.lookup n (commands cmdEnv) of
|
-> case Map.lookup n (commands cmdEnv) of
|
||||||
Just inf -> do let flg_compls = ['-':flg | (flg,_) <- flags inf, isPrefixOf pref flg]
|
Just inf -> do let flg_compls = ['-':flg | (flg,_) <- flags inf, isPrefixOf pref flg]
|
||||||
@@ -265,7 +265,7 @@ wordCompletion gfenv line0 prefix0 p =
|
|||||||
-> do mb_abs <- try (evaluate (abstract pgf))
|
-> do mb_abs <- try (evaluate (abstract pgf))
|
||||||
case mb_abs of
|
case mb_abs of
|
||||||
Right abs -> ret ' ' [name | cid <- Map.keys (funs abs), let name = prCId cid, isPrefixOf pref name]
|
Right abs -> ret ' ' [name | cid <- Map.keys (funs abs), let name = prCId cid, isPrefixOf pref name]
|
||||||
Left _ -> ret ' ' []
|
Left (_ :: SomeException) -> ret ' ' []
|
||||||
_ -> ret ' ' []
|
_ -> ret ' ' []
|
||||||
where
|
where
|
||||||
line = decode gfenv line0
|
line = decode gfenv line0
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ process mbt fn !seqs !funs (item@(Active j ppos funid seqid args key0):items) ac
|
|||||||
FSymTok tok -> let !acc' = fn tok (Active j (ppos+1) funid seqid args key0) acc
|
FSymTok tok -> let !acc' = fn tok (Active j (ppos+1) funid seqid args key0) acc
|
||||||
in process mbt fn seqs funs items acc' chart
|
in process mbt fn seqs funs items acc' chart
|
||||||
FSymLit d r -> let !fid = args !! d
|
FSymLit d r -> let !fid = args !! d
|
||||||
in case [t | set <- IntMap.lookup fid (forest chart), FConst _ t <- Set.toList set] of
|
in case [t | FConst _ t <- maybe [] Set.toList (IntMap.lookup fid (forest chart))] of
|
||||||
(tok:_) -> let !acc' = fn (KS tok) (Active j (ppos+1) funid seqid args key0) acc
|
(tok:_) -> let !acc' = fn (KS tok) (Active j (ppos+1) funid seqid args key0) acc
|
||||||
in process mbt fn seqs funs items acc' chart
|
in process mbt fn seqs funs items acc' chart
|
||||||
[] -> case litCatMatch fid mbt of
|
[] -> case litCatMatch fid mbt of
|
||||||
|
|||||||
Reference in New Issue
Block a user