summaryrefslogtreecommitdiff
path: root/src/GF/Infra/UseIO.hs
diff options
context:
space:
mode:
authorpeb <unknown>2005-02-24 10:46:37 +0000
committerpeb <unknown>2005-02-24 10:46:37 +0000
commitbf436aebaa5b84bbb50e305e8f7dc9ca4ae34299 (patch)
tree346ac1e13a90d7b2c992c69f45b3e19c22f4bfe2 /src/GF/Infra/UseIO.hs
parent0137dd5511a83ea4672619ad3dc22fe7c51ab4bf (diff)
"Committed_by_peb"
Diffstat (limited to 'src/GF/Infra/UseIO.hs')
-rw-r--r--src/GF/Infra/UseIO.hs56
1 files changed, 9 insertions, 47 deletions
diff --git a/src/GF/Infra/UseIO.hs b/src/GF/Infra/UseIO.hs
index 5d4c147e0..51dfc71e8 100644
--- a/src/GF/Infra/UseIO.hs
+++ b/src/GF/Infra/UseIO.hs
@@ -5,56 +5,14 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date: 2005/02/18 19:21:16 $
+-- > CVS $Date: 2005/02/24 11:46:36 $
-- > CVS $Author: peb $
--- > CVS $Revision: 1.8 $
+-- > CVS $Revision: 1.9 $
--
-- (Description of the module)
-----------------------------------------------------------------------------
-module UseIO (prOptCPU,
- putCPU,
- putPoint,
- putPoint',
- readFileIf,
- FileName,
- InitPath,
- FullPath,
- getFilePath,
- readFileIfPath,
- doesFileExistPath,
- extendPathEnv,
- pFilePaths,
- prefixPathName,
- justInitPath,
- nameAndSuffix,
- unsuffixFile, fileBody,
- fileSuffix,
- justFileName,
- suffixFile,
- justModuleName,
- getLineWell,
- putStrFlush,
- putStrLnFlush,
- -- * a generic quiz session
- QuestionsAndAnswers,
- teachDialogue,
- -- * IO monad with error; adapted from state monad
- IOE(..),
- appIOE,
- ioe,
- ioeIO,
- ioeErr,
- ioeBad,
- useIOE,
- foldIOE,
- putStrLnE,
- putStrE,
- putPointE,
- putPointEVerb,
- readFileIOE,
- readFileLibraryIOE
- ) where
+module UseIO where
import Operations
import Arch (prCPU)
@@ -67,11 +25,13 @@ import Monad
putShow' :: Show a => (c -> a) -> c -> IO ()
putShow' f = putStrLn . show . length . show . f
+putIfVerb :: Options -> String -> IO ()
putIfVerb opts msg =
if oElem beVerbose opts
then putStrLn msg
else return ()
+putIfVerbW :: Options -> String -> IO ()
putIfVerbW opts msg =
if oElem beVerbose opts
then putStr (' ' : msg)
@@ -88,8 +48,10 @@ errOptIO os e m = case m of
putIfVerb os k
return e
+prOptCPU :: Options -> Integer -> IO Integer
prOptCPU opts = if (oElem noCPU opts) then (const (return 0)) else prCPU
+putCPU :: IO ()
putCPU = do
prCPU 0
return ()
@@ -194,7 +156,7 @@ putStrFlush s = putStr s >> hFlush stdout
putStrLnFlush :: String -> IO ()
putStrLnFlush s = putStrLn s >> hFlush stdout
--- a generic quiz session
+-- * a generic quiz session
type QuestionsAndAnswers = [(String, String -> (Integer,String))]
@@ -222,7 +184,7 @@ teachDialogue qas welc = do
"You can interrupt the quiz by entering a line consisting of a dot ('.').\n"
--- IO monad with error; adapted from state monad
+-- * IO monad with error; adapted from state monad
newtype IOE a = IOE (IO (Err a))