Îõ³h$5ä1é§      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦None >ÀÎ shell-monadAn arbitrary value. shell-monad=Quotes a value 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.ÎThe single quotes are omitted for simple values that do not need any quoting. shell-monadÅA value that is safely quoted so that it can be exposed to the shell.åWhile the constructor is exposed, you should avoid directly constucting Quoted values. Instead, use .None  '(5>?ÀÉÔ×Ù0í× shell-monad7This data type represents shell Arithmetic Expressions.“Note that in shell arithmetic, expressions that would evaluate to a Bool, such as ANot and AEqual instead evaluate to 1 for True and 0 for False. shell-monadnegation shell-monad§ shell-monad¨ shell-monad© shell-monadª shell-monad« shell-monad¬ shell-monad­ shell-monad® shell-monad¯  shell-monad°! shell-monad±" shell-monad²# shell-monad³$ shell-monad´% shell-monad#OR of the bits of the two arguments& shell-monad$XOR of the bits of the two arguments' shell-monad$AND of the bits of the two arguments( shell-monadÒshift left (first argument's bits are shifted by the value of the second argument)) shell-monad shift right* shell-monadÙif the first argument is non-zero, the result is the second, else the result is the third+ shell-monadêNote that this should only include things that test(1) and shell built-in test commands support portably.D shell-monad”Any 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.øOr, it can be passed a tuple of (Fd, FilePath), in which case the specified Fd will be redirected to/from the FilePath.K shell-monadÚClass of values that provide a hint for the name to use for a shell variable or function.0If you don't want to provide a naming hint, use (). v1 <- _ () To provide a naming hint, use L. v1 <- _ (L "x") L shell-monadÕSuggests that a shell variable or function have its name contain the specified Text.N shell-monadÁ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/" <>))P shell-monadÜ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"))R shell-monad/Allows a function to take any number of Params.S shell-monadÃA Param is anything that can be used as the parameter of a command.T shell-monadShell script monad.U shell-monadUsed for a static value.V shell-monad#Used to represent a shell variable.W shell-monad4A term that can be expanded in a shell command line.X shell-monadTreats the Text as a glob.When used as a S> to a command, it expands to one parameter per matching file. ÃforCmd (cmd "ls" (glob "*/*.cabal")) $ \file -> cmd "echo" fileWhen used in a q#, it matches text against the glob.Ï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.Y shell-monadÐGenerates a shell script, including hashbang, suitable to be written to a file.Z shell-monad&Generates a single line of shell code.[ shell-monad#Adds a shell command to the script.\ shell-monad$Variadic and polymorphic version of [-A command can be passed any number of Params. ëdemo = script $ do cmd "echo" "hello, world" name <- newVar () readVar name cmd "echo" "hello" nameFor the most efficient use of \è, 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": Ïdemo = script $ do echovar <- newVarContaining "echo" () cmd echovar "hi"] shell-monad>Adds a comment that is embedded in the generated shell script.^ shell-monad5Makes a Static Term from any value that can be shown._ shell-monad=Defines a new shell variable, which starts out not being set.>Each call to newVar will generate a new, unique variable name.ÌThe namehint can influence this name, but is modified to ensure uniqueness.` shell-monadÄCreates a new shell variable with an initial value coming from any S. For example, ²packageName <- newVarFrom (Output $ cmd "grep" "-i" "name\\s*:" (glob "*.cabal") -|- cmd "perl" "-pe" "s/^name\\s*:\\s*//i") (NamedLike "packageName")Use this with N= to store to modified value of a variable in a new variable. Ðhome <- globalVar "HOME" cabalDir <- newVarFrom (WithVar home (<> "/.cabal")) ()4Or to capture the output of an arithmetic operation. &sum <- newVarFrom (val x `APlus` 1) ()a shell-monadÝCreates a new shell variable, with an initial value which can be anything that can be shown. äs <- newVarContaining "foo bar baz" (NamedLike "s") i <- newVarContaining (1 :: Int) (NamedLike "i")b shell-monad(Sets the Var to the value of the param. c shell-monad9Gets a Var that refers to a global variable, such as PATHd shell-monadÑThis special Var expands to whatever parameters were passed to the shell script.ÊInside a func, it expands to whatever parameters were passed to the func. (This is $@ in shell)e shell-monadŒTakes the first positional parameter, removing it from positionalParameters and returning a new Var that holds the value of the parameter.ÑIf there are no more positional parameters, the script will crash with an error. For example: ôremovefirstfile = script $ do cmd "rm" =<< takeParameter cmd "echo" "remaining parameters:" positionalParametersf shell-monadµ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.g shell-monad›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.h shell-monadù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.i shell-monad:Produces a Var that is a trimmed version of the input Var.áThe 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 Xè, it could match in multiple ways. You can choose whether to remove the shortest or the longest match.äThe act of trimming a Var is assumed to be able to produce a new Var holding a different data type.j shell-monadÔGenerates 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.k shell-monadÖDefines 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: Ødemo = script $ do hohoho <- mkHohoho hohoho (static 1) echo "And I heard him exclaim, ere he rode out of sight ..." hohoho (static 3) mkHohoho :: Script (Term Val Int -> Script ()) mkHohoho = func (NamedLike "hohoho") $ do num <- takeParameter forCmd (cmd "seq" "1" num) $ \_n -> cmd "echo" "Ho, ho, ho!" "Merry xmas!"l shell-monadÆRuns the command, and separates its output into parts (using the IFS)ÂThe action is run for each part, passed a Var containing the part.m shell-monadÂAs long as the first Script exits nonzero, runs the second script.n shell-monadif with a Script conditional.ÅIf the conditional exits 0, the first action is run, else the second.o shell-monadwhen with a monadic conditionalp shell-monad!unless with a monadic conditionalq shell-monadÑMatches the value of the Var against the Quoted Text (which can be generated by X?), and runs the Script action associated with the first match. óarg <- takeParameter () caseOf arg [ (quote "-h", showHelp) , (glob "-*", cmd "echo" "Unknown option:" arg) ]r shell-monad"Runs the script in a new subshell.s shell-monad;Runs the script as a command group in the current subshell.t shell-monad6Add a variable to the local environment of the script.u shell-monad-Fills a variable with a line read from stdin.v shell-monad™By default, shell scripts continue running past commands that exit nonzero. Use 'stopOnFailure True' to make the script stop on the first such command.w shell-monad'Makes a nonzero exit status be ignored.x shell-monadPipes together two Scripts.y shell-monadANDs two Scripts.z shell-monadORs two Scripts.{ shell-monad3Redirects to a file, overwriting any existing file.(For example, to shut up a noisy command: cmd "find" "/" |> "/dev/null"| shell-monad?Appends to a file. (If file doesn't exist, it will be created.)} shell-monad%Redirects standard input from a file.~ shell-monad&Redirects a script's output to stderr. shell-monad&stdOutput€ shell-monad=Redirects the first file descriptor to input from the second. For example, to read from Fd 42: cmd "foo" &stdInput<&Fd 42 shell-monad Helper for  and €‚ shell-monadÀProvides the Text as input to the Script, using a here-document.ƒ shell-monadÄCreates a Script that checks a Test and exits true (0) or false (1).-Useful with ifCmd, whenCmd, etc; for example: *ifCmd (test (FileExists "foo")) (foo, bar)„ shell-monadLifts a Term to Arith.Ž shell-monad'Quoted Text arguments are passed as-is.’ shell-monad*String arguments are automatically quoted.“ shell-monad(Text arguments are automatically quoted.– shell-monad6Allows passing the output of a command as a parameter.— shell-monadÓAllows modifying the value of a shell variable before it is passed to the command. shell-monad Note that ¶, ·, and ¸ cannot be used with Arith.ž shell-monad‰Arith is an instance of Num, which allows you to write expressions like this with shell variables, that generate Arithmetic Expressions. val x * (100 + val y)Ÿ shell-monad7Allows passing an Arithmetic Expression as a parameter.ö !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„öTYZWVUX[\SRPQLMK^_`abcdefgjiHIJEFGNOklmnopqrstxyzD{|}~€‚vwhƒ+,-./0123456789:;<=>?@ABC„ !"#$%&'()*]u¹      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNNOOPPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨¦§©¦§ª¦«¬¦«­®¯°¦±²¦±³®¯´®¯µ®¯¶®¯·®¯¸®¯¹¦º»¦¼½¦¼¾¦¼¿À)shell-monad-0.6.10-3Ico8RgCGcMJuXFOfSWElSControl.Monad.Shell.QuoteControl.Monad.ShellValQuotablequoteQuotedQgetQ$fIsStringQuoted $fQuotable[]$fQuotableText $fQuotableVal$fQuotableVal0$fQuotableVal1 $fEqQuoted $fOrdQuoted $fShowQuoted$fSemigroupQuoted$fMonoidQuotedArithANumAVarAStaticANegateAPlusAMinusAMultADivAModANotAOrAAndAEqual ANotEqualALTAGTALEAGEABitOrABitXOrABitAnd AShiftLeft AShiftRightAIfTestTNotTAndTOrTEmpty TNonEmpty TStrEqual TStrNotEqualTEqual TNotEqualTGTTLTTGETLE TFileEqual TFileNewer TFileOlder TBlockExists TCharExists TDirExists TFileExistsTRegularFileExistsTSymlinkExists TFileNonEmptyTFileExecutable RedirFile Direction FromBeginningFromEnd Greediness ShortestMatch LongestMatch NameHinted NamedLikeWithVarOutput CmdParamsParamScriptStaticVarTermglobscript linearScriptruncmdcommentstaticnewVar newVarFromnewVarContainingsetVar globalVarpositionalParameters takeParameter defaultVarwhenVar errUnlessVartrimVar lengthVarfuncforCmdwhileCmdifCmdwhenCmd unlessCmdcaseOfsubshellgroupwithEnvreadVar stopOnFailure ignoreFailure-|--&&--||-|>|>>|<toStderr>&<&& hereDocumenttestval $fNamedFunc$fNamedVarName $fMonoidEnv$fSemigroupEnv $fMonadScript$fApplicativeScript$fNamedUntypedVar $fNumTerm $fNamedTerm $fParamQuoted $fParamTerm $fParamTerm0$fParamUntypedVar $fParam[] $fParamText$fCmdParamsScript $fCmdParams-> $fParamOutput$fParamWithVar$fNameHintedMaybe$fNameHintedNamedLike$fNameHinted()$fRedirFile(,) $fRedirFile[] $fEnumArith $fNumArith $fParamArith$fFunctorScript$fEqFunc $fOrdFunc $fShowFunc $fEqVarName $fOrdVarName $fShowVarNamebaseGHC.Num+-*GHC.Real/modghc-prim GHC.Classesnot Data.Foldableorand==/=<><=>=GHC.BasemappendGHC.EnumfromEnum enumFromToenumFromThenTo