Shellac-0.9: A framework for creating shell envinronmentsContentsIndex
System.Console.Shell.ShellMonad
Contents
The Shell monad
Output functions
Shell state accessors
Special actions
Description
This module implements a monad for use in shell commands and in evaluation functions. It is a state moand layered over IO. liftIO may be used to execute arbitrary I/O actions. However, the shellPut* commands are the preferred way to output text.
Synopsis
data Sh st a
runSh :: st -> OutputCommand -> Sh st () -> IO (CommandResult st)
shellPut :: BackendOutput -> Sh st ()
shellPutStr :: String -> Sh st ()
shellPutStrLn :: String -> Sh st ()
shellPutInfo :: String -> Sh st ()
shellPutInfoLn :: String -> Sh st ()
shellPutErr :: String -> Sh st ()
shellPutErrLn :: String -> Sh st ()
getShellSt :: Sh st st
putShellSt :: st -> Sh st ()
modifyShellSt :: (st -> st) -> Sh st ()
shellSpecial :: ShellSpecial st -> Sh st ()
The Shell monad
data Sh st a
The type of shell commands. This monad is a stae monad layerd over IO. It is also a member of MonadException which allows safe exception handling.
show/hide Instances
MonadState st (Sh st)
??? a st => Monad (Sh st a)
??? a st => MonadIO (Sh st a)
CommandFunction (Sh st ()) st
runSh :: st -> OutputCommand -> Sh st () -> IO (CommandResult st)
Execute a shell action
Output functions
shellPut :: BackendOutput -> Sh st ()
Output a tagged string to the console
shellPutStr :: String -> Sh st ()
Prints a regular output string with a line terminator
shellPutStrLn :: String -> Sh st ()
Prints regular output with a line terminator
shellPutInfo :: String -> Sh st ()
Prints an informational output string
shellPutInfoLn :: String -> Sh st ()
Prints an informational output string with a line terminator
shellPutErr :: String -> Sh st ()
Prints an error output string
shellPutErrLn :: String -> Sh st ()
Prints and error output string with a line terminator
Shell state accessors
getShellSt :: Sh st st
Get the current shell state
putShellSt :: st -> Sh st ()
Set the shell state
modifyShellSt :: (st -> st) -> Sh st ()
Apply the given funtion to the shell state
Special actions
shellSpecial :: ShellSpecial st -> Sh st ()
Schedule a shell "special" action. Only the last call to this function will affect the shell's behavior! It modifies a bit of state that is overwritten on each call.
Produced by Haddock version 0.8