ContentsIndex
CLI.Basics
Contents
The global state
Exceptions
Running rules with user input
Running rules with predefined args
Utils
Setters and getters
Description
This module exposes internal structures and utility functions used in the CLI refinement shell. It has to be imported only if you want to write your own CLI plugins (command handlers, condition solvers, etc.)
Synopsis
module Core.DerivationTree
type Action prog a = StateT (World prog) IO a
data World prog = World {
derivation :: (Maybe (DTree prog))
rules :: [Rule prog]
cmdHandlers :: [CmdHandler prog]
}
data CmdHandler prog = CmdHandler {
cmd :: String
cmdDesc :: Doc
handleCmd :: (String -> Action prog ())
}
mkWorld :: [Rule prog] -> [CmdHandler prog] -> World prog
data ReadlineException = ReadlineException
data QuitException = QuitException
data HandlerException = HandlerException String
getArgument' :: forall a . (Boxable a, Parse a) => Doc -> IO a
readInput :: Parse a => String -> IO a
getInput :: String -> IO String
readNextArg :: Typeable b => a -> StateT [RuleArg] IO b
formatDesc :: String -> String -> Doc
handleCommand :: String -> Action prog Bool
getDerivation :: Action prog (DTree prog)
replaceHandler :: CmdHandler prog -> Action prog ()
updateDerivation :: (DTree prog -> DTree prog) -> World prog -> World prog
setSelection :: Region -> World prog -> World prog
setDerivation :: DTree prog -> World prog -> World prog
getActiveCode :: Prog syn prog => Action prog (Code syn)
Documentation
module Core.DerivationTree
The global state
type Action prog a = StateT (World prog) IO a
data World prog
Constructors
World
derivation :: (Maybe (DTree prog))
rules :: [Rule prog]
cmdHandlers :: [CmdHandler prog]List of command handlers.
data CmdHandler prog
Constructors
CmdHandler
cmd :: String

The user command that the handler reacts to. This must match the first token of the user input.

The command should not contain problematic characters. Otherwise readline completion may have problems.

cmdDesc :: DocDescription of what the command does.
handleCmd :: (String -> Action prog ())The handler function
mkWorld :: [Rule prog] -> [CmdHandler prog] -> World prog
Exceptions
data ReadlineException
Constructors
ReadlineException
show/hide Instances
data QuitException
Constructors
QuitException
show/hide Instances
Typeable QuitException
data HandlerException
Constructors
HandlerException String
show/hide Instances
Running rules with user input
getArgument' :: forall a . (Boxable a, Parse a) => Doc -> IO a
readInput :: Parse a => String -> IO a
getInput :: String -> IO String
Running rules with predefined args
readNextArg :: Typeable b => a -> StateT [RuleArg] IO b
Utils
formatDesc
:: Stringsynopsis
-> Stringdescription
-> Doc
Standard command description layout.
handleCommand
:: StringUser input
-> Action prog BoolReturn False if command given and not found.
getDerivation :: Action prog (DTree prog)
replaceHandler :: CmdHandler prog -> Action prog ()
Setters and getters
updateDerivation :: (DTree prog -> DTree prog) -> World prog -> World prog
setSelection :: Region -> World prog -> World prog
setDerivation :: DTree prog -> World prog -> World prog
getActiveCode :: Prog syn prog => Action prog (Code syn)
Produced by Haddock version 0.8