Shellac-0.9.5: A framework for creating shell envinronments




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.


The Shell monad

data Sh st a Source

The type of shell commands. This monad is a state monad layered over IO. The type parameter st allows the monad to carry around a package of user-defined state.


MonadState st (Sh st) 
Monad (Sh st) 
MonadIO (Sh st) 
CommandFunction (Sh st ()) st 

runSh :: st -> OutputCommand -> Sh st () -> IO (CommandResult st)Source

Execute a shell action

Output functions

shellPut :: BackendOutput -> Sh st ()Source

Output a tagged string to the console

shellPutStr :: String -> Sh st ()Source

Prints a regular output string

shellPutStrLn :: String -> Sh st ()Source

Prints regular output with a line terminator

shellPutInfo :: String -> Sh st ()Source

Prints an informational output string

shellPutInfoLn :: String -> Sh st ()Source

Prints an informational output string with a line terminator

shellPutErr :: String -> Sh st ()Source

Prints an error output string

shellPutErrLn :: String -> Sh st ()Source

Prints and error output string with a line terminator

Shell state accessors

getShellSt :: Sh st stSource

Get the current shell state

putShellSt :: st -> Sh st ()Source

Set the shell state

modifyShellSt :: (st -> st) -> Sh st ()Source

Apply the given funtion to the shell state

Special actions

shellSpecial :: ShellSpecial st -> Sh st ()Source

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.