1
0
forked from GitHub/gf-core

More haddock documentation improvements

This commit is contained in:
hallgren
2014-10-16 14:03:57 +00:00
parent c0ebbc4edf
commit c924491289
16 changed files with 92 additions and 56 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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