Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class HasSourcePath a where
- sourcePath :: a -> FilePath
- data Location
- data L a = L Location a
- unLoc :: L a -> a
- noLoc :: a -> L a
- ppLocation :: FilePath -> Location -> Doc
- ppL :: (Pretty a1, Pretty a3) => L a3 -> a1 -> Doc
- data Options
- data Flags = Flags {
- optMode :: Mode
- optStopAfterPhase :: Phase
- optVerbosity :: Verbosity
- optShowCPUTime :: Bool
- optOutputFormats :: [OutputFormat]
- optSISR :: Maybe SISRFormat
- optHaskellOptions :: Set HaskellOption
- optLexicalCats :: Set String
- optLiteralCats :: Set Ident
- optGFODir :: Maybe FilePath
- optOutputDir :: Maybe FilePath
- optGFLibPath :: Maybe [FilePath]
- optDocumentRoot :: Maybe FilePath
- optRecomp :: Recomp
- optProbsFile :: Maybe FilePath
- optRetainResource :: Bool
- optName :: Maybe String
- optPreprocessors :: [String]
- optEncoding :: Maybe String
- optPMCFG :: Bool
- optOptimizations :: Set Optimization
- optOptimizePGF :: Bool
- optSplitPGF :: Bool
- optCFGTransforms :: Set CFGTransform
- optLibraryPath :: [FilePath]
- optStartCat :: Maybe String
- optSpeechLanguage :: Maybe String
- optLexer :: Maybe String
- optUnlexer :: Maybe String
- optWarnings :: [Warning]
- optDump :: [Dump]
- optTagsOnly :: Bool
- optHeuristicFactor :: Maybe Double
- optCaseSensitive :: Bool
- optPlusAsBind :: Bool
- optJobs :: Maybe (Maybe Int)
- optTrace :: Bool
- data Mode
- data Phase
- data Verbosity
- data OutputFormat
- data SISRFormat
- data Optimization
- data CFGTransform
- data HaskellOption
- newtype Dump = Dump Pass
- data Pass
- data Recomp
- outputFormatsExpl :: [((String, OutputFormat), String)]
- parseOptions :: ErrorMonad err => [String] -> err (Options, [FilePath])
- parseModuleOptions :: ErrorMonad err => [String] -> err Options
- fixRelativeLibPaths :: [Char] -> [FilePath] -> Options -> Options
- optionsGFO :: Options -> [(String, Literal)]
- optionsPGF :: Options -> [(String, Literal)]
- addOptions :: Options -> Options -> Options
- concatOptions :: [Options] -> Options
- noOptions :: Options
- modifyFlags :: (Flags -> Flags) -> Options
- helpMessage :: String
- flag :: (Flags -> a) -> Options -> a
- cfgTransform :: Options -> CFGTransform -> Bool
- haskellOption :: Options -> HaskellOption -> Bool
- readOutputFormat :: MonadFail m => String -> m OutputFormat
- isLexicalCat :: Options -> String -> Bool
- isLiteralCat :: Options -> Ident -> Bool
- renameEncoding :: String -> String
- getEncoding :: Options -> String
- defaultEncoding :: [Char]
- setOptimization :: Optimization -> Bool -> Options
- setCFGTransform :: CFGTransform -> Bool -> Options
- verbAtLeast :: Options -> Verbosity -> Bool
- dump :: Options -> Dump -> Bool
- data Err a
- err :: (String -> b) -> (a -> b) -> Err a -> b
- maybeErr :: ErrorMonad m => String -> Maybe a -> m a
- testErr :: ErrorMonad m => Bool -> String -> m ()
- fromErr :: a -> Err a -> a
- errIn :: ErrorMonad m => String -> m a -> m a
- lookupErr :: (ErrorMonad m, Eq a, Show a) => a -> [(a, b)] -> m b
- class (Functor m, Monad m) => ErrorMonad m where
- checks :: ErrorMonad m => [m a] -> m a
- liftErr :: ErrorMonad m => Err a -> m a
- checkUnique :: (Show a, Eq a) => [a] -> [String]
- unifyMaybeBy :: (Eq b, MonadFail m) => (a -> b) -> Maybe a -> Maybe a -> m (Maybe a)
- unifyMaybe :: (Eq a, MonadFail m) => Maybe a -> Maybe a -> m (Maybe a)
- mapPairsM :: Monad m => (b -> m c) -> [(a, b)] -> m [(a, c)]
- pairM :: Monad m => (b -> m c) -> (b, b) -> m (c, c)
- indent :: Int -> String -> String
- (+++) :: String -> String -> String
- (++-) :: String -> String -> String
- (++++) :: String -> String -> String
- (+++-) :: String -> String -> String
- (+++++) :: String -> String -> String
- prUpper :: String -> String
- prReplicate :: Int -> String -> String
- prTList :: String -> [String] -> String
- prQuotedString :: String -> String
- prParenth :: String -> String
- prCurly :: String -> String
- prBracket :: String -> String
- prArgList :: [String] -> String
- prSemicList :: [String] -> String
- prCurlyList :: [String] -> String
- restoreEscapes :: String -> String
- numberedParagraphs :: [[String]] -> [String]
- prConjList :: String -> [String] -> String
- prIfEmpty :: String -> String -> String -> String -> String
- wrapLines :: Int -> String -> String
- topoTest :: Ord a => [(a, [a])] -> Either [a] [[a]]
- topoTest2 :: Ord a => [(a, [a])] -> Either [[a]] [[a]]
- readIntArg :: String -> Int
- iterFix :: Eq a => ([a] -> [a]) -> [a] -> [a]
- chunks :: Eq a => a -> [a] -> [[a]]
- class Monad m => Output m where
- type IOE a = IO a
- type FullPath = String
- type InitPath = String
- type FileName = String
- putIfVerb :: Output f => Options -> String -> f ()
- gfLibraryPath :: [Char]
- gfGrammarPathVar :: [Char]
- getLibraryDirectory :: MonadIO io => Options -> io [FilePath]
- getGrammarPath :: MonadIO io => [FilePath] -> io [FilePath]
- extendPathEnv :: MonadIO io => Options -> io [FilePath]
- getSubdirs :: FilePath -> IO [FilePath]
- justModuleName :: FilePath -> String
- isGF :: FilePath -> Bool
- isGFO :: FilePath -> Bool
- gfFile :: FilePath -> FilePath
- gfoFile :: FilePath -> FilePath
- gf2gfo :: Options -> FilePath -> FilePath
- gf2gfo' :: Maybe FilePath -> FilePath -> FilePath
- splitInModuleSearchPath :: String -> [FilePath]
- tryIOE :: IOE a -> IO (Err a)
- useIOE :: a -> IOE a -> IO a
- maybeIO :: MonadIO f => IO a -> f (Maybe a)
- die :: String -> IO a
- putPointE :: (Output m, MonadIO m) => Verbosity -> Options -> String -> m b -> m b
- ioErrorText :: IOError -> String
- timeIt :: MonadIO m => m b -> m (Integer, b)
- writeUTF8File :: FilePath -> String -> IO ()
- readBinaryFile :: FilePath -> IO String
- writeBinaryFile :: FilePath -> String -> IO ()
- class Monad m => MonadIO (m :: Type -> Type) where
- liftErr :: ErrorMonad m => Err a -> m a
- catch :: IO a -> (IOError -> IO a) -> IO a
- try :: IO a -> IO (Either IOError a)
- setConsoleEncoding :: IO ()
- changeConsoleEncoding :: String -> IO ()
- data TermColors = TermColors {}
- getTermColors :: MonadIO m => m TermColors
- class Binary t
- encode :: Binary a => a -> ByteString
- decode :: Binary a => ByteString -> a
- encodeFile :: Binary a => FilePath -> a -> IO ()
- decodeFile :: Binary a => FilePath -> IO a
Supporting infrastructure and system utilities
Source locations
class HasSourcePath a where Source #
sourcePath :: a -> FilePath Source #
Instances
HasSourcePath ModuleInfo Source # | |
Defined in GF.Grammar.Grammar sourcePath :: ModuleInfo -> FilePath Source # |
Attaching location information
Command line options
Option types
Instances
Bounded Verbosity Source # | |
Enum Verbosity Source # | |
Defined in GF.Infra.Option succ :: Verbosity -> Verbosity # pred :: Verbosity -> Verbosity # fromEnum :: Verbosity -> Int # enumFrom :: Verbosity -> [Verbosity] # enumFromThen :: Verbosity -> Verbosity -> [Verbosity] # enumFromTo :: Verbosity -> Verbosity -> [Verbosity] # enumFromThenTo :: Verbosity -> Verbosity -> Verbosity -> [Verbosity] # | |
Eq Verbosity Source # | |
Ord Verbosity Source # | |
Defined in GF.Infra.Option | |
Show Verbosity Source # | |
data OutputFormat Source #
Instances
Eq OutputFormat Source # | |
Defined in GF.Infra.Option (==) :: OutputFormat -> OutputFormat -> Bool # (/=) :: OutputFormat -> OutputFormat -> Bool # | |
Ord OutputFormat Source # | |
Defined in GF.Infra.Option compare :: OutputFormat -> OutputFormat -> Ordering # (<) :: OutputFormat -> OutputFormat -> Bool # (<=) :: OutputFormat -> OutputFormat -> Bool # (>) :: OutputFormat -> OutputFormat -> Bool # (>=) :: OutputFormat -> OutputFormat -> Bool # max :: OutputFormat -> OutputFormat -> OutputFormat # min :: OutputFormat -> OutputFormat -> OutputFormat # | |
Read OutputFormat Source # | |
Defined in GF.Infra.Option readsPrec :: Int -> ReadS OutputFormat # readList :: ReadS [OutputFormat] # | |
Show OutputFormat Source # | |
Defined in GF.Infra.Option showsPrec :: Int -> OutputFormat -> ShowS # show :: OutputFormat -> String # showList :: [OutputFormat] -> ShowS # |
data SISRFormat Source #
SISR_WD20030401 | SISR Working draft 1 April 2003 http://www.w3.org/TR/2003/WD-semantic-interpretation-20030401/ |
SISR_1_0 |
Instances
Eq SISRFormat Source # | |
Defined in GF.Infra.Option (==) :: SISRFormat -> SISRFormat -> Bool # (/=) :: SISRFormat -> SISRFormat -> Bool # | |
Ord SISRFormat Source # | |
Defined in GF.Infra.Option compare :: SISRFormat -> SISRFormat -> Ordering # (<) :: SISRFormat -> SISRFormat -> Bool # (<=) :: SISRFormat -> SISRFormat -> Bool # (>) :: SISRFormat -> SISRFormat -> Bool # (>=) :: SISRFormat -> SISRFormat -> Bool # max :: SISRFormat -> SISRFormat -> SISRFormat # min :: SISRFormat -> SISRFormat -> SISRFormat # | |
Show SISRFormat Source # | |
Defined in GF.Infra.Option showsPrec :: Int -> SISRFormat -> ShowS # show :: SISRFormat -> String # showList :: [SISRFormat] -> ShowS # |
data Optimization Source #
Instances
Eq Optimization Source # | |
Defined in GF.Infra.Option (==) :: Optimization -> Optimization -> Bool # (/=) :: Optimization -> Optimization -> Bool # | |
Ord Optimization Source # | |
Defined in GF.Infra.Option compare :: Optimization -> Optimization -> Ordering # (<) :: Optimization -> Optimization -> Bool # (<=) :: Optimization -> Optimization -> Bool # (>) :: Optimization -> Optimization -> Bool # (>=) :: Optimization -> Optimization -> Bool # max :: Optimization -> Optimization -> Optimization # min :: Optimization -> Optimization -> Optimization # | |
Show Optimization Source # | |
Defined in GF.Infra.Option showsPrec :: Int -> Optimization -> ShowS # show :: Optimization -> String # showList :: [Optimization] -> ShowS # |
data CFGTransform Source #
CFGNoLR | |
CFGRegular | |
CFGTopDownFilter | |
CFGBottomUpFilter | |
CFGStartCatOnly | |
CFGMergeIdentical | |
CFGRemoveCycles |
Instances
Eq CFGTransform Source # | |
Defined in GF.Infra.Option (==) :: CFGTransform -> CFGTransform -> Bool # (/=) :: CFGTransform -> CFGTransform -> Bool # | |
Ord CFGTransform Source # | |
Defined in GF.Infra.Option compare :: CFGTransform -> CFGTransform -> Ordering # (<) :: CFGTransform -> CFGTransform -> Bool # (<=) :: CFGTransform -> CFGTransform -> Bool # (>) :: CFGTransform -> CFGTransform -> Bool # (>=) :: CFGTransform -> CFGTransform -> Bool # max :: CFGTransform -> CFGTransform -> CFGTransform # min :: CFGTransform -> CFGTransform -> CFGTransform # | |
Show CFGTransform Source # | |
Defined in GF.Infra.Option showsPrec :: Int -> CFGTransform -> ShowS # show :: CFGTransform -> String # showList :: [CFGTransform] -> ShowS # |
data HaskellOption Source #
Instances
Eq HaskellOption Source # | |
Defined in GF.Infra.Option (==) :: HaskellOption -> HaskellOption -> Bool # (/=) :: HaskellOption -> HaskellOption -> Bool # | |
Ord HaskellOption Source # | |
Defined in GF.Infra.Option compare :: HaskellOption -> HaskellOption -> Ordering # (<) :: HaskellOption -> HaskellOption -> Bool # (<=) :: HaskellOption -> HaskellOption -> Bool # (>) :: HaskellOption -> HaskellOption -> Bool # (>=) :: HaskellOption -> HaskellOption -> Bool # max :: HaskellOption -> HaskellOption -> HaskellOption # min :: HaskellOption -> HaskellOption -> HaskellOption # | |
Show HaskellOption Source # | |
Defined in GF.Infra.Option showsPrec :: Int -> HaskellOption -> ShowS # show :: HaskellOption -> String # showList :: [HaskellOption] -> ShowS # |
outputFormatsExpl :: [((String, OutputFormat), String)] Source #
Option parsing
:: ErrorMonad err | |
=> [String] | list of string arguments |
-> err (Options, [FilePath]) |
:: ErrorMonad err | |
=> [String] | list of string arguments |
-> err Options |
Option pretty-printing
optionsGFO :: Options -> [(String, Literal)] Source #
Pretty-print the options that are preserved in .gfo files.
optionsPGF :: Options -> [(String, Literal)] Source #
Pretty-print the options that are preserved in .pgf files.
Option manipulation
concatOptions :: [Options] -> Options Source #
helpMessage :: String Source #
Checking specific options
cfgTransform :: Options -> CFGTransform -> Bool Source #
haskellOption :: Options -> HaskellOption -> Bool Source #
readOutputFormat :: MonadFail m => String -> m OutputFormat Source #
renameEncoding :: String -> String Source #
This is for bacward compatibility. Since GHC 6.12 we started using the native Unicode support in GHC but it uses different names for the code pages.
getEncoding :: Options -> String Source #
defaultEncoding :: [Char] Source #
Setting specific options
setOptimization :: Optimization -> Bool -> Options Source #
setCFGTransform :: CFGTransform -> Bool -> Options Source #
Convenience methods for checking options
The Error monad
Like Maybe
type with error msgs
Instances
Monad Err Source # | |
Functor Err Source # | added 2/10/2003 by PEB |
MonadFail Err Source # | |
Defined in GF.Data.ErrM | |
Applicative Err Source # | |
Alternative Err Source # | |
MonadPlus Err Source # | added by KJ |
ErrorMonad Err Source # | |
Eq a => Eq (Err a) Source # | |
Read a => Read (Err a) Source # | |
Show a => Show (Err a) Source # | |
errIn :: ErrorMonad m => String -> m a -> m a Source #
Error monad class
class (Functor m, Monad m) => ErrorMonad m where Source #
Instances
ErrorMonad IO Source # | Make raise and handle mimic behaviour of the old IOE monad |
ErrorMonad Err Source # | |
checks :: ErrorMonad m => [m a] -> m a Source #
liftErr :: ErrorMonad m => Err a -> m a Source #
Checking
unifyMaybe :: (Eq a, MonadFail m) => Maybe a -> Maybe a -> m (Maybe a) Source #
this is what happens when matching two values in the same module
Monadic operations on lists and pairs
Printing
prQuotedString :: String -> String Source #
prSemicList :: [String] -> String Source #
prCurlyList :: [String] -> String Source #
restoreEscapes :: String -> String Source #
numberedParagraphs :: [[String]] -> [String] Source #
Topological sorting
topoTest :: Ord a => [(a, [a])] -> Either [a] [[a]] Source #
Topological sorting with test of cyclicity
topoTest2 :: Ord a => [(a, [a])] -> Either [[a]] [[a]] Source #
Topological sorting with test of cyclicity, new version /TH 2012-06-26
Misc
readIntArg :: String -> Int Source #
iterFix :: Eq a => ([a] -> [a]) -> [a] -> [a] Source #
Fix point iterator (for computing e.g. transitive closures or reachability)
Files and IO
class Monad m => Output m where Source #
ePutStr :: String -> m () Source #
ePutStrLn :: String -> m () Source #
gfLibraryPath :: [Char] Source #
gfGrammarPathVar :: [Char] Source #
extendPathEnv :: MonadIO io => Options -> io [FilePath] Source #
extends the search path with the
gfLibraryPath
and gfGrammarPathVar
environment variables. Returns only existing paths.
justModuleName :: FilePath -> String Source #
splitInModuleSearchPath :: String -> [FilePath] Source #
useIOE :: a -> IOE a -> IO a Source #
Print the error message and return a default value if the IO operation fail
s
ioErrorText :: IOError -> String Source #
Because GHC adds the confusing text "user error" for failures caused by
calls to fail
.
Reused
class Monad m => MonadIO (m :: Type -> Type) where #
Monads in which IO
computations may be embedded.
Any monad built by applying a sequence of monad transformers to the
IO
monad will be an instance of this class.
Instances should satisfy the following laws, which state that liftIO
is a transformer of monads:
Instances
liftErr :: ErrorMonad m => Err a -> m a Source #
Backwards compatible try and catch
Console IO
Changing which character encoding to use for console IO
setConsoleEncoding :: IO () Source #
Set the console encoding (for Windows, has no effect on Unix-like systems)
changeConsoleEncoding :: String -> IO () Source #
Console colors
data TermColors Source #
Instances
Show TermColors Source # | |
Defined in GF.System.Console showsPrec :: Int -> TermColors -> ShowS # show :: TermColors -> String # showList :: [TermColors] -> ShowS # |
getTermColors :: MonadIO m => m TermColors Source #
Binary serialisation
The Binary
class provides put
and get
, methods to encode and
decode a Haskell value to a lazy ByteString. It mirrors the Read and
Show classes for textual representation of Haskell types, and is
suitable for serialising Haskell values to disk, over the network.
For parsing and generating simple external binary formats (e.g. C structures), Binary may be used, but in general is not suitable for complex protocols. Instead use the Put and Get primitives directly.
Instances of Binary should satisfy the following property:
decode . encode == id
That is, the get
and put
methods should be the inverse of each
other. A range of instances are provided for basic Haskell types.
put, get
Instances
encode :: Binary a => a -> ByteString Source #
Encode a value using binary serialisation to a lazy ByteString.
decode :: Binary a => ByteString -> a Source #
Decode a value from a lazy ByteString, reconstructing the original structure.
encodeFile :: Binary a => FilePath -> a -> IO () Source #
Lazily serialise a value to a file
This is just a convenience function, it's defined simply as:
encodeFile f = B.writeFile f . encode
So for example if you wanted to compress as well, you could use:
B.writeFile f . compress . encode
decodeFile :: Binary a => FilePath -> IO a Source #
Lazily reconstruct a value previously written to a file.
This is just a convenience function, it's defined simply as:
decodeFile f = return . decode =<< B.readFile f
So for example if you wanted to decompress as well, you could use:
return . decode . decompress =<< B.readFile f