z<      !"#$%&'()*+,-./0123456789:;None -24=BKTAny function that takes a RedirFile can be passed a a FilePath, in which case the default file descriptor will be redirected to/from the FilePath.xOr, it can be passed a tuple of (Fd, FilePath), in which case the specified Fd will be redirected to/from the FilePath.ZClass of values that provide a hint for the name to use for a shell variable or function.QTo skip providing a hint, use '()'. To provide a hint, use '(NamedLike "name")'.USuggests that a shell variable or function have its name contain the specified Text. Allows modifying the value of a variable before it is passed to a command. The function is passed a Quoted Text which will expand to the value of the variable, and can modify it, by using eg <. (cmd "rmdir" (WithVar name ("/home/" <>)) An arbitrary value.\The output of a command, or even a more complicated Script can be passed as a parameter to  Examples: cmd "echo" "hello there," (Output (cmd "whoami")) cmd "echo" "root's pwent" (Output (cmd "cat" "/etc/passwd" -|- cmd "grep" "root"))/Allows a function to take any number of Params.CA Param is anything that can be used as the parameter of a command.=rEnvironment built up by the shell script monad, so it knows which environment variables and functions are in use.Shell script monad.>Specifies a redirection.?use a here document as input@same, but for input fdAredirect first fd to the secondBuse a file as inputCappend to fileDredirect the fd to a fileEA shell expression.F#Redirects a file handle of the ExprG||H&&I(Piping the first Expr to the second ExprJexpressions run in a sub-shellK a commentL a commandMA shell function.A value that is safely quoted.A shell variable.>Quotes the Text to allow it to be safely exposed to the shell.The method used is to replace ' with '"'"' and wrap the value inside single quotes. This works for POSIX shells, as well as other shells like csh.MTreats the Text as a glob, which expands to one parameter per matching file.The input is assumed to be a well-formed glob. Characters in it that are not alphanumeric and are not wildcard characters will be escaped before it is exposed to the shell. This allows eg, spaces in globs.NIndents an ExprO4runScriptuate the monad and generates a list of ExprPJRuns the monad, and returns a list of Expr and the modified environment.QbRuns the passed Script, using the current environment, and returns the list of Expr it generates.PGenerates a shell script, including hashbang, suitable to be written to a file.R!Formats an Expr to shell script.:Can generate either multiline or single line shell script.S'Displays a Fd for use in a redirection.Redirections have a default Fd; for example, ">" defaults to redirecting stdout. In this case, the file descriptor number does not need to be included.T]Finds an approriate marker to end a here document; the marker cannot appear inside the text.&Generates a single line of shell code.#Adds a shell command to the script.$Variadic and polymorphic version of -A command can be passed any number of Params. odemo = script $ do cmd "echo" "hello, world" name <- newVar "name" readVar name cmd "echo" "hello" nameFor the most efficient use of h, add the following boilerplate, which will make string literals in your program default to being Text: {-# LANGUAGE OverloadedStrings, ExtendedDefaultRules #-} {-# OPTIONS_GHC -fno-warn-type-defaults #-} import Control.Monad.Shell import qualified Data.Text.Lazy as L default (L.Text)Note that the command to run is itself a Param, so it can be a Text, or a String, or even a Var or Output. For example, this echos "hi": Odemo = script $ do echovar <- newVarContaining "echo" () cmd echovar "hi"UAdds an Expr to the script.>Adds a comment that is embedded in the generated shell script.=Defines a new shell variable, which starts out not being set.>Each call to newVar will generate a new, unique variable name.LThe namehint can influence this name, but is modified to ensure uniqueness.4Creates a new shell variable, with an initial value.(Sets the Var to the value of the param. 9Gets a Var that refers to a global variable, such as PATH QThis special Var expands to whatever parameters were passed to the shell script.JInside a func, it expands to whatever parameters were passed to the func. (This is $@ in shell)!Takes the first positional parameter, removing it from positionalParameters and returning a new Var that holds the value of the parameter.QIf there are no more positional parameters, the script will crash with an error. For example: tremovefirstfile = script $ do cmd "rm" =<< takeParameter cmd "echo" "remaining parameters:" positionalParametersVCreates a new shell variable, but does not ensure that it's not already set to something. For use when the caller is going to generate some shell script that is guaranteed to clobber any existing value of the variable."Generates a new Var. Expanding this Var will yield the same result as expanding the input Var, unless it is empty, in which case it instead defaults to the expansion of the param.#Generates a new Var. If the input Var is empty, then this new Var will likewise expand to the empty string. But if not, the new Var expands to the param.$Generates a new Var. If the input Var is empty then expanding this new Var will cause an error to be thrown, using the param as the error message. If the input Var is not empty, then the new Var expands to the same thing the input Var expands to.%TGenerates a new Var, which expands to the length of the expansion of the input Var.[Note that 'lengthVar positionalParameters' expands to the number of positional parameters.&:Produces a Var that is a trimmed version of the input Var.aThe Quoted Text is removed from the value of the Var, either from the beginning or from the end.#If the Quoted Text was produced by h, it could match in multiple ways. You can choose whether to remove the shortest or the longest match.'VDefines a shell function, and returns an action that can be run to call the function.The action is variadic; it can be passed any number of CmdParams. Typically, it will make sense to specify a more concrete type when defining the shell function.The shell function will be given a unique name, that is not used by any other shell function. The namehint can be used to influence the contents of the function name, which makes for more readable generated shell code. For example: Mdemo = script $ do hohoho <- mkHohoho hohoho (Val 1) echo "And I heard him exclaim, ere he rode out of sight ..." hohoho (Val 3) mkHohoho :: Script (Val Int -> Script ()) mkHohoho = func (NamedLike "hohoho") $ do num <- takeParameter forCmd (cmd "seq" "1" num) $ \_n -> cmd "echo" "Ho, ho, ho!" "Merry xmas!"(FRuns the command, and separates its output into parts (using the IFS)BThe action is run for each part, passed a Var containing the part.)BAs long as the first Script exits nonzero, runs the second script.*if with a monadic conditionalEIf the conditional exits 0, the first action is run, else the second.+when with a monadic conditional,!unless with a monadic conditional-QMatches the value of the Var against the Quoted Text (which can be generated by ?), and runs the Script action associated with the first match.WBCreates a block such as "do : ; cmd ; cmd" or "else : ; cmd ; cmd"The use of : ensures that the block is not empty, and allows for more regular indetnetion, as well as making the single line formatting work..DGenerates shell code to fill a variable with a line read from stdin./By default, shell scripts continue running past commands that exit nonzero. Use "stopOnFailure True" to make the script stop on the first such command.0'Makes a nonzero exit status be ignored.1Pipes together two Scripts.2ANDs two Scripts.3ORs two Scripts.43Redirects to a file, overwriting any existing file.(For example, to shut up a noisy command: cmd "find" "/" |> "/dev/null"5?Appends to a file. (If file doesn't exist, it will be created.)6%Redirects standard input from a file.7&Redirects a script's output to stderr.8<Redirects the first file descriptor to output to the second.6For example, to redirect a command's stderr to stdout: cmd "foo" &stdError>&stdOutput9=Redirects the first file descriptor to input from the second. For example, to read from Fd 42: cmd "foo" &stdInput<&Fd 42: Helper for 8 and 9;@Provides the Text as input to the Script, using a here-document.X6Allows passing the output of a command as a parameter.Y'Quoted Text arguments are passed as-is.ZSAllows modifying the value of a shell variable before it is passed to the command.[XVar arguments cause the (quoted) value of a shell variable to be passed to the command.\-Any value that can be shown can be passed to ; just wrap it inside a Val.]*String arguments are automatically quoted.^(Text arguments are automatically quoted._` ab=cdef>?@ABCDEFGHIJKLMghijklmnoNpqOPQRSrTsU !Vtu"#$%&'()*v+,-W./0123wxyz456789:;{|}~XYZ[\]^<  !"#$%&'()*+,-./0123456789:;<   !"#%& '()*+,-123456789:;/0$.__`   ab=cdef>DCBA@?ELKJIHGFMghijklmnoNpqOPQRSrTsU !Vtu"#$%&'()*v+,-W./0123wxyz456789:;{|}~XYZ[\]^          !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ab=cdMefgghijklmnopqrstuvwxyz{|}~shell-monad-0.3.1Control.Monad.Shell RedirFile DirectionFromEnd FromBeginning Greediness LongestMatch ShortestMatch NameHinted NamedLikeWithVarValOutput CmdParamsParamScriptQuotedVarquoteglobscript linearScriptruncmdcommentnewVarnewVarContainingsetVar globalVarpositionalParameters takeParameter defaultVarwhenVar errUnlessVar lengthVartrimVarfuncforCmdwhileCmdifCmdwhenCmd unlessCmdcaseOfreadVar stopOnFailure ignoreFailure-|--&&--||-|>|>>|<toStderr>&<&& hereDocumentbase Data.MonoidmappendEnv RedirSpec RedirHereDoc RedirInput RedirOutput RedirFromFileRedirToFileAppend RedirToFileExprRedirOrAndPipeSubshellCommentCmdFuncindentgen runScriptrunMfmtredirFd eofMarkeradd newVarUnsafeblock $fParamOutput $fParamQuoted$fParamWithVar $fParamVar $fParamVal $fParam[] $fParamText fromRedirFilehintedcmdAll toTextParamenvVarsenvFuncsQgetQVarNamevarName expandVar simpleVar modifyEnvVarsmodifyEnvFuncsshowFdtoLinearScriptmodVarmodVar'ifCmd'combine toSingleExpredir fileRedir$fRedirFile(,) $fRedirFile[]$fNameHintedMaybe$fNameHintedNamedLike$fNameHinted()$fCmdParamsScript$fCmdParams(->) $fMonoidEnv $fMonadScript