mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 11:42:49 -06:00
Restore compatibility with GHC 7.0
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
{-# LANGUAGE CPP #-}
|
||||||
-- | pgf-shell: A simple shell to illustrate the use of the Haskell binding
|
-- | pgf-shell: A simple shell to illustrate the use of the Haskell binding
|
||||||
-- to the C implementation of the PGF run-time system.
|
-- to the C implementation of the PGF run-time system.
|
||||||
--
|
--
|
||||||
@@ -11,7 +12,7 @@ import Control.Monad(forever)
|
|||||||
import Data.Char(isSpace)
|
import Data.Char(isSpace)
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
import System.IO(hFlush,stdout)
|
import System.IO(hFlush,stdout)
|
||||||
import System.IO.Error(catchIOError)
|
import qualified System.IO.Error as S
|
||||||
import System.Environment
|
import System.Environment
|
||||||
import PGF2
|
import PGF2
|
||||||
import System.Mem(performGC)
|
import System.Mem(performGC)
|
||||||
@@ -23,7 +24,7 @@ getPGF [path] = pgfShell =<< readPGF path
|
|||||||
getPGF _ = putStrLn "Usage: pgf-shell <path to pgf>"
|
getPGF _ = putStrLn "Usage: pgf-shell <path to pgf>"
|
||||||
|
|
||||||
pgfShell pgf =
|
pgfShell pgf =
|
||||||
do putStrLn . unwords . map fst . M.toList $ languages pgf
|
do putStrLn . unwords . M.keys $ languages pgf
|
||||||
forever $ do performGC
|
forever $ do performGC
|
||||||
putStr "> "; hFlush stdout
|
putStr "> "; hFlush stdout
|
||||||
execute pgf =<< readLn
|
execute pgf =<< readLn
|
||||||
@@ -38,7 +39,7 @@ execute pgf cmd =
|
|||||||
cto <- getConcr' pgf to
|
cto <- getConcr' pgf to
|
||||||
putl [linearize cto t|(t,_)<-parse cfrom (startCat pgf) s]
|
putl [linearize cto t|(t,_)<-parse cfrom (startCat pgf) s]
|
||||||
_ -> putStrLn "Huh?"
|
_ -> putStrLn "Huh?"
|
||||||
`catchIOError` print
|
`catch` print
|
||||||
|
|
||||||
getConcr' pgf lang =
|
getConcr' pgf lang =
|
||||||
maybe (fail $ "Concrete syntax not found: "++show lang) return $
|
maybe (fail $ "Concrete syntax not found: "++show lang) return $
|
||||||
@@ -61,3 +62,7 @@ instance Read Command where
|
|||||||
++ [(T l1 l2 r3,"") | ("t",r1)<-lex s,
|
++ [(T l1 l2 r3,"") | ("t",r1)<-lex s,
|
||||||
(l1,r2)<-lex r1,
|
(l1,r2)<-lex r1,
|
||||||
(l2,r3)<-lex r2]
|
(l2,r3)<-lex r2]
|
||||||
|
|
||||||
|
#if MIN_VERSION_base(4,6,0)
|
||||||
|
catch = S.catchIOError
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ cabal-version: >=1.10
|
|||||||
library
|
library
|
||||||
exposed-modules: PGF2
|
exposed-modules: PGF2
|
||||||
other-modules: PGF2.FFI
|
other-modules: PGF2.FFI
|
||||||
build-depends: base >=4.5 && <4.7, bytestring >=0.9 && <0.11,
|
build-depends: base >=4.3, bytestring >=0.9,
|
||||||
containers
|
containers
|
||||||
-- hs-source-dirs:
|
-- hs-source-dirs:
|
||||||
build-tools: hsc2hs
|
build-tools: hsc2hs
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{-# LANGUAGE BangPatterns #-}
|
{-# LANGUAGE CPP, BangPatterns #-}
|
||||||
module PGF.Optimize
|
module PGF.Optimize
|
||||||
( optimizePGF
|
( optimizePGF
|
||||||
, updateProductionIndices
|
, updateProductionIndices
|
||||||
@@ -11,7 +11,11 @@ import PGF.Macros
|
|||||||
import Data.List (mapAccumL)
|
import Data.List (mapAccumL)
|
||||||
import Data.Array.IArray
|
import Data.Array.IArray
|
||||||
import Data.Array.MArray
|
import Data.Array.MArray
|
||||||
|
#if MIN_VERSION_base(4,6,0)
|
||||||
import Data.Array.Unsafe as U(unsafeFreeze)
|
import Data.Array.Unsafe as U(unsafeFreeze)
|
||||||
|
#else
|
||||||
|
import Data.Array.ST as U(unsafeFreeze)
|
||||||
|
#endif
|
||||||
import Data.Array.ST
|
import Data.Array.ST
|
||||||
import Data.Array.Unboxed
|
import Data.Array.Unboxed
|
||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
|
|||||||
Reference in New Issue
Block a user