From 43d5016996905cc4fd325ecc739d64eb29aa0aa1 Mon Sep 17 00:00:00 2001 From: hallgren Date: Tue, 25 Sep 2012 19:08:33 +0000 Subject: Use the SIO monad in the GF shell + The restrictions on arbitrary IO when GF is running in restricted mode is now enforced in the types. + This hopefully also solves an intermittent problem when accessing the GF shell through the web API provided by gf -server. This was visible in the Simple Translation Tool and probably caused by some low-level bug in the GHC IO libraries. --- src/compiler/GF/Command/Interpreter.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/compiler/GF/Command/Interpreter.hs') diff --git a/src/compiler/GF/Command/Interpreter.hs b/src/compiler/GF/Command/Interpreter.hs index 5758c24f4..dd5a05594 100644 --- a/src/compiler/GF/Command/Interpreter.hs +++ b/src/compiler/GF/Command/Interpreter.hs @@ -6,6 +6,7 @@ module GF.Command.Interpreter ( interpretPipe, getCommandOp ) where +import Prelude hiding (putStrLn) import GF.Command.Commands import GF.Command.Abstract @@ -14,7 +15,7 @@ import PGF import PGF.Data import PGF.Morphology import GF.System.Signal -import GF.Infra.UseIO +import GF.Infra.SIO import GF.Infra.Option import Text.PrettyPrint @@ -38,7 +39,7 @@ mkCommandEnv pgf = emptyCommandEnv :: CommandEnv emptyCommandEnv = mkCommandEnv emptyPGF -interpretCommandLine :: CommandEnv -> String -> IO () +interpretCommandLine :: CommandEnv -> String -> SIO () interpretCommandLine env line = case readCommandLine line of Just [] -> return () @@ -82,7 +83,7 @@ appCommand xs c@(Command i os arg) = case arg of EFun x -> EFun x -- return the trees to be sent in pipe, and the output possibly printed -interpret :: CommandEnv -> [Expr] -> Command -> IO CommandOutput +interpret :: CommandEnv -> [Expr] -> Command -> SIO CommandOutput interpret env trees comm = case getCommand env trees comm of Left msg -> do putStrLn ('\n':msg) -- cgit v1.2.3