a bit of refactoring

This commit is contained in:
krangelov
2021-12-13 11:04:13 +01:00
parent bb053119b3
commit 404feea345
2 changed files with 21 additions and 24 deletions

View File

@@ -25,15 +25,15 @@ import GF.System.Catch
import Paths_gf(getDataDir)
import GF.System.Directory
import GF.System.Console
import GF.Text.Pretty
import System.FilePath
import System.IO
import System.IO.Error(isUserError,ioeGetErrorString)
import System.Environment
import System.Exit
import System.CPUTime
--import System.Cmd
import Text.Printf
--import Control.Applicative(Applicative(..))
import Control.Monad(when,liftM,foldM)
import Control.Monad.Trans(MonadIO(..))
import Control.Monad.State(StateT,lift)
@@ -233,6 +233,21 @@ putPointE v opts msg act = do
return a
dumpOut opts pass doc
| dump opts d = ePutStrLn (render ("\n\n--#" <+> show d $$ doc))
| otherwise = return ()
where
d = (Dump pass)
warnOut opts warnings
| null warnings = return ()
| otherwise = do t <- getTermColors
ePutStr (blueFg t);ePutStr ws;ePutStrLn (restore t)
where
ws = if flag optVerbosity opts == Normal
then '\n':warnings
else warnings
-- | Because GHC adds the confusing text "user error" for failures caused by
-- calls to 'fail'.
ioErrorText e = if isUserError e