diff options
| author | hallgren <hallgren@chalmers.se> | 2014-10-16 14:03:57 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2014-10-16 14:03:57 +0000 |
| commit | c924491289259fa8a5a259ed97f2d9e817e3338c (patch) | |
| tree | 178f045daa6520ca0979d093167727511c06541e /src/compiler/GF/Infra | |
| parent | c0ebbc4edfeaf16a6a5f4392ea097ea3d72a0e06 (diff) | |
More haddock documentation improvements
Diffstat (limited to 'src/compiler/GF/Infra')
| -rw-r--r-- | src/compiler/GF/Infra/Ident.hs | 6 | ||||
| -rw-r--r-- | src/compiler/GF/Infra/Option.hs | 14 | ||||
| -rw-r--r-- | src/compiler/GF/Infra/UseIO.hs | 26 |
3 files changed, 27 insertions, 19 deletions
diff --git a/src/compiler/GF/Infra/Ident.hs b/src/compiler/GF/Infra/Ident.hs index 272efca03..3c5402985 100644 --- a/src/compiler/GF/Infra/Ident.hs +++ b/src/compiler/GF/Infra/Ident.hs @@ -12,15 +12,15 @@ -- (Description of the module) ----------------------------------------------------------------------------- -module GF.Infra.Ident (-- * Identifiers +module GF.Infra.Ident (-- ** Identifiers Ident, ident2utf8, showIdent, prefixIdent, identS, identC, identV, identA, identAV, identW, argIdent, isArgIdent, getArgIndex, varStr, varX, isWildIdent, varIndex, - -- * Raw Identifiers + -- ** Raw Identifiers RawIdent, rawIdentS, rawIdentC, ident2raw, prefixRawIdent, isPrefixOf, showRawIdent{-, - -- * Refreshing identifiers + -- ** Refreshing identifiers IdState, initIdStateN, initIdState, lookVar, refVar, refVarPlus-} ) where diff --git a/src/compiler/GF/Infra/Option.hs b/src/compiler/GF/Infra/Option.hs index 8bcb52cc5..9785f6895 100644 --- a/src/compiler/GF/Infra/Option.hs +++ b/src/compiler/GF/Infra/Option.hs @@ -1,6 +1,6 @@ module GF.Infra.Option ( - -- * Option types + -- ** Option types Options, Flags(..), Mode(..), Phase(..), Verbosity(..), @@ -8,21 +8,21 @@ module GF.Infra.Option SISRFormat(..), Optimization(..), CFGTransform(..), HaskellOption(..), Dump(..), Pass(..), Recomp(..), outputFormatsExpl, - -- * Option parsing + -- ** Option parsing parseOptions, parseModuleOptions, fixRelativeLibPaths, - -- * Option pretty-printing + -- ** Option pretty-printing optionsGFO, optionsPGF, - -- * Option manipulation + -- ** Option manipulation addOptions, concatOptions, noOptions, modifyFlags, helpMessage, - -- * Checking specific options + -- ** Checking specific options flag, cfgTransform, haskellOption, readOutputFormat, isLexicalCat, isLiteralCat, renameEncoding, getEncoding, defaultEncoding, - -- * Setting specific options + -- ** Setting specific options setOptimization, setCFGTransform, - -- * Convenience methods for checking options + -- ** Convenience methods for checking options verbAtLeast, dump ) where diff --git a/src/compiler/GF/Infra/UseIO.hs b/src/compiler/GF/Infra/UseIO.hs index 6de68bc44..e0477c1fc 100644 --- a/src/compiler/GF/Infra/UseIO.hs +++ b/src/compiler/GF/Infra/UseIO.hs @@ -12,7 +12,9 @@ -- (Description of the module) ----------------------------------------------------------------------------- -module GF.Infra.UseIO(module GF.Infra.UseIO,MonadIO(..),liftErr) where +module GF.Infra.UseIO(module GF.Infra.UseIO,liftErr, + -- ** Reused + MonadIO(..),liftErr) where import Prelude hiding (catch) @@ -38,6 +40,8 @@ import Control.Exception(evaluate) --putIfVerb :: MonadIO io => Options -> String -> io () putIfVerb opts msg = when (verbAtLeast opts Verbose) $ putStrLnE msg +-- ** GF files path and library path manipulation + type FileName = String type InitPath = String -- ^ the directory portion of a pathname type FullPath = String @@ -119,7 +123,7 @@ splitInModuleSearchPath s = case break isPathSep s of -- --- * IO monad with error; adapted from state monad +-- ** IO monad with error; adapted from state monad newtype IOE a = IOE { appIOE :: IO (Err a) } @@ -165,6 +169,8 @@ die :: String -> IO a die s = do hPutStrLn stderr s exitFailure +-- ** Diagnostic output + class Monad m => Output m where ePutStr, ePutStrLn, putStrE, putStrLnE :: String -> m () @@ -195,13 +201,21 @@ putPointE v opts msg act = do return a +-- | Because GHC adds the confusing text "user error" for failures caused by +-- calls to fail. +ioErrorText e = if isUserError e + then ioeGetErrorString e + else show e + +-- ** Timing + timeIt act = do t1 <- liftIO $ getCPUTime a <- liftIO . evaluate =<< act t2 <- liftIO $ getCPUTime return (t2-t1,a) --- * File IO +-- ** File IO writeUTF8File :: FilePath -> String -> IO () writeUTF8File fpath content = @@ -210,9 +224,3 @@ writeUTF8File fpath content = readBinaryFile path = hGetContents =<< openBinaryFile path ReadMode writeBinaryFile path s = withBinaryFile path WriteMode (flip hPutStr s) - --- | Because GHC adds the confusing text "user error" for failures caused by --- calls to fail. -ioErrorText e = if isUserError e - then ioeGetErrorString e - else show e |
