From 018c9838ed31571b699118ae75b1d62d5527fd77 Mon Sep 17 00:00:00 2001 From: hallgren Date: Wed, 20 Nov 2013 00:45:33 +0000 Subject: Reduced clutter in monadic code + Eliminated vairous ad-hoc coersion functions between specific monads (IO, Err, IOE, Check) in favor of more general lifting functions (liftIO, liftErr). + Generalized many basic monadic operations from specific monads to arbitrary monads in the appropriate class (MonadIO and/or ErrorMonad), thereby completely eliminating the need for lifting functions in lots of places. This can be considered a small step forward towards a cleaner compiler API and more malleable compiler code in general. --- src/compiler/GFServer.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/compiler/GFServer.hs') diff --git a/src/compiler/GFServer.hs b/src/compiler/GFServer.hs index 5b247806a..c28a99c5e 100644 --- a/src/compiler/GFServer.hs +++ b/src/compiler/GFServer.hs @@ -7,7 +7,7 @@ import Control.Monad(when) import Control.Monad.State(StateT(..),get,gets,put) import Control.Monad.Error(ErrorT(..),Error(..)) import System.Random(randomRIO) -import System.IO(stderr,hPutStrLn) +--import System.IO(stderr,hPutStrLn) import GF.System.Catch(try) import System.IO.Error(isAlreadyExistsError) import GF.System.Directory(doesDirectoryExist,doesFileExist,createDirectory, @@ -33,7 +33,7 @@ import Text.JSON(encode,showJSON,makeObj) import System.Process(readProcessWithExitCode) import System.Exit(ExitCode(..)) import Codec.Binary.UTF8.String(decodeString,encodeString) -import GF.Infra.UseIO(readBinaryFile,writeBinaryFile) +import GF.Infra.UseIO(readBinaryFile,writeBinaryFile,ePutStrLn) import GF.Infra.SIO(captureSIO) import qualified PGFService as PS import qualified ExampleService as ES @@ -334,7 +334,7 @@ serveStaticFile' path = return (resp404 path) -- * Logging -logPutStrLn s = liftIO . hPutStrLn stderr $ s +logPutStrLn s = ePutStrLn s -- * JSONP output -- cgit v1.2.3