úΖÉid      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abc Safe-InferredˆLong options. Options that are preceded with two dashes on the command line and typically consist of an entire mnemonic word, such as linesÿ. However, anything that is at least one letter long is fine for a long option name. The name must be at least one character long. It cannot have an equal sign anywhere in its name. Otherwise any Unicode character is good (including pathological ones like newlines).èShort options. Options that are preceded with a single dash on the command line and consist of a single letter. That single letter cannot be a dash. Any other Unicode character is good (including pathological ones like newlines).ZCreates a short option. Returns Nothing if the character is not valid for a short option.OMakes a long option. Returns Nothing if the string is not a valid long option. defdef Safe-Inferred@Error messages. To format error messages for nice display, see . ÃParsers. Internally the parser tracks what input remains to be parsed, whether there are any pending short options, and whether a stopper has been seen. A parser can return a value of any type.ŠThe parser also includes the notion of failure. Any parser can fail; a failed parser affects the behavior of combinators such as choice.good af always succeeds without consuming any input and has result a. This provides the implementation for  and  .zCombines two parsers into a single parser. The second parser can optionally depend upon the result from the first parser.ÛThis applies the first parser. If the first parser succeeds, combine then takes the result from the first parser, applies the function given to the result from the first parser, and then applies the resulting parser.qIf the first parser fails, combine will not apply the second function but instead will bypass the second parser.%This provides the implementation for g in h. failString sŽ always fails without consuming any input. The failure contains a record of the string passed in by s. This provides the implementation for  ..Fail with an unhelpful error message. Usually  throwStringK is more useful, but this is handy to implement some typeclass instances.ÿ-Runs the first parser. If it fails without consuming any input, then runs the second parser. If the first parser succeeds, then returns the result of the first parser. If the first parser fails and consumes input, then returns the result of the first parser. This provides the implementation for <|> in i.jApplies ko if a parser would succeed without consuming any input. Useful for preventing infinite loops on parsers like .HRuns a parser one or more times. Runs the parser once and then applies .ÿ"Runs a parser zero or more times. If the last run of the parser fails without consuming any input, this parser succeeds without consuming any input. If the last run of the parser fails while consuming input, this parser fails while consuming input. This provides the implementation for many in Control.Applicative.«Runs the parser given. If it fails without consuming any input, replaces all Expected messages with the one given. Otherwise, returns the result of the parser unchanged.?Runs a parser. This is the only way to change a value of type Parser a into a value of type aa (that is, it is the only way to "get out of the Parser monad" or to "escape the Parser monad".)ÿ^Parses only pending short options. Fails without consuming any input if there has already been a stopper or if there are no pending short options. Fails without consuming any input if there is a pending short option, but it does not match the short option given. Succeeds and consumes a pending short option if it matches the short option given. lookAhead pÿ runs parser p. If p succeeds, lookAhead p succeeds without consuming any input. If p fails without consuming any input, so does lookAhead. If p fails and consumes input, lookAhead also fails and consumes input. If this is undesirable, combine with "try".MParses only non-pending short options. Fails without consuming any input if:there are pending short options there has already been a stopper$there are no arguments left to parse$the next argument is an empty string,the next argument does not begin with a dash"the next argument is a single dashJthe next argument is a short option but it does not match the one giventhe next argument is a stopper­Otherwise, consumes the next argument, puts any remaining letters from the argument into a pending short, and removes the first word from remaining arguments to be parsed.ßParses an exact long option. That is, the text of the command-line option must exactly match the text of the option. Returns any argument that is attached to the same word of the option with an equal sign (for example, --follow=/dev/random will return Just "/dev/random"• for the argument.) If there is no equal sign, returns Nothing for the argument. If there is an equal sign but there is nothing after it, returns Just "" for the argument.¦If you do not want your long option to have equal signs and GNU-style option arguments, wrap this parser in something that will fail if there is an option argument.%Fails without consuming any input if:there are pending short optionsa stopper has been parsed/there are no arguments left on the command lineGthe next argument on the command line does not begin with two dashes)the next argument on the command line is -- (a stopper)~the next argument on the command line does begin with two dashes but its text does not match the argument we're looking forlÿ+Takes a single String and returns a tuple, where the first element is the first two letters, the second element is everything from the third letter to the equal sign, and the third element is Nothing if there is no equal sign, or Just String with everything after the equal sign if there is one.ÿExamines the next word. If it matches a LongOpt in the set unambiguously, returns a tuple of the word actually found and the matching word in the set and the accompanying text after the equal sign (if any). If the Set is empty, this parser will always fail.BParses only pending short option arguments. For example, for the tail" command, if you enter the option -c25, then after parsing the -c option the 25b becomes a pending short option argument because it was in the same command line argument as the -c.%Fails without consuming any input if:!a stopper has already been parsed+there are no pending short option argumentsgOn success, returns the String of the pending short option argument (this String will never be empty).Parses a "stopper" - that is, a double dash. Changes the internal state of the parser to reflect that a stopper has been seen.pIf a stopper has already been seen, change the internal state back to indicating that no stopper has been seen.Mtry p behaves just like p, but if p fails, try p will not consume any input. ÿuReturns the next string on the command line as long as there are no pendings. Succeeds even if a stopper is present. Be careful - this will return the next string even if it looks like an option (that is, it starts with a dash.) Consider whether you should be using nonOptionPosArg instead. However this can be useful when parsing command line options after a stopper.!ÿ9Parses the next word on the command line, but only if it exactly matches the word given. Otherwise, fails without consuming any input. Also fails without consuming any input if there are pending short options or if a stopper has already been parsed. Does not pay any attention to whether a stopper is present."FIf there are pending short options, fails without consuming any input.õOtherwise, if a stopper has NOT already been parsed, then returns the next word if it is either a single dash or any other word that does not begin with a dash. If the next word does not meet these criteria, fails without consuming any input.Otherwise, if a stopper has already been parsed, then returns the next word, regardless of whether it begins with a dash or not.#(Succeeds if there is no more input left.$ÿ>Examines the possible words in Set. If there are no pendings, then get the next word and see if it matches one of the words in Set. If so, returns the word actually parsed and the matching word from Set. If there is no match, fails without consuming any input. Pays no attention to whether a stopper has been seen.%manyTill p end0 runs parser p zero or more times until parser end succeeds. If endM succeeds and consumes input, that input is also consumed. in the result of manyTill$. If that is a problem, wrap it in  lookAhead . Also, if end fails and consumes input, manyTill7 fails and consumes input. If that is a problem, wrap end in try.;mnopqr stuvw xyzjUse this label when applying k@Command line arguments to parse. Presumably you got these from getArgs^. If there is any chance that you will be parsing Unicode strings, see the documentation in Multiarg.GetArgs before you use  . Parser to runSuccess or failure. Any parser might fail; for example, the command line might not have any values left to parse. Use of the + combinator can lead to a list of failures.{|l}~ !"#$%€‚ƒ„…   !"#$% % !"$#  0monprq stuvw xyzj{|l}~ !"#$%€‚ƒ„… Safe-Inferred&9Specifies how many arguments each option takes. As with ÿ, there are (at least) two ways to use this type. You can simply represent each possible option using different data constructors in an algebraic data type. Or you can have each ArgSpec yield a function that transforms a record. For an example that uses an algebraic data type, see Multiarg.SampleParser.wMost of these value constructors take as an argument a function that returns an Either. The function should return a Left InputErrorÐ if the parsing of the arguments failed--if, for example, the user needs to enter an integer but she instead input a letter. The functions should return a Right if parsing of the arguments was successful.'ÿ-This option takes a single argument, which must match one of the strings given in the list. The user may supply the shortest unambiguous string. If the argument list to ChoiceArg has duplicate strings, only the first string is used. For instance, ChoiceArg could be useful if you were parsing the --colorQ option to GNU grep, which requires the user to supply one of three arguments: always, never, or auto.(µThis option takes a variable number of arguments--zero or more. Option arguments continue until the command line contains a word that begins with a hyphen. For example, if option a- takes a variable number of arguments, then -a one two three -b will be parsed as a taking three arguments, and -a -b will be parsed as a* taking no arguments. If the user enters -aa as the last option on the command line, then the only way to indicate the end of arguments for a= and the beginning of positional argments is with a stopper.)8This option takes three arguments. Parsed similarly to +.*6This option takes two arguments. Parsed similarly to +.+0This option takes one argument. Here, if option a takes one argument, -a -b will be parsed with -b being an argument to option a, even though -b< starts with a hyphen and therefore "looks like" an option.,”This option takes an optional argument. As noted in "The Tao of Option Parsing", optional arguments can result in some ambiguity. (Read it here:  -http://optik.sourceforge.net/doc/1.5/tao.html ) If option a" takes an optional argument, and b is also an option, what does -ab> mean? SimpleParser resolves this ambiguity by assuming that b is an argument to a3. If the user does not like this, she can specify -a -b (in such an instance -b is not parsed as an option to -a , because -b¢ begins with a hyphen and therefore "looks like" an option.) Certainly though, optional arguments lead to ambiguity, so if you don't like it, don't use them :)-This option takes no arguments.3Indicates errors when parsing options to arguments./JParsing the argument failed with this error message. An example might be !option argument is not an integer or option argument is too largeˆ. The text of the options the user provided is automatically prepended to the error message, so do not replicate this in your message.0aNo error message accompanies this failure. multiarg will create a generic error message for you.1Specifies options for the 9< function. Each OptSpec represents one command-line option.3-Each String is a single long option, such as versionÿ. When the user specifies long options on the command line, she must type two dashes; however, do not include the dashes when you specify the long option here. Strings you specify as long options cannot include a dash as either the first or the second character, and they cannot include an equal sign anywhere. If your long option does not meet these conditions, a runtime error will occur.4,Each Char is a single short option, such as vH. The character cannot be a dash; if it is, a runtime error will occur.5aWhat to do each time one of the given long options or short options appears on the command line.6notFollowedBy pÿ succeeds only if parser p fails. If p fails, notFollowedBy succeeds without consuming any input. If p succeeds and consumes input, notFollowedBy fails and consumes input. If p succeeds and does not consume any input, notFollowedBy fails and does not consume any input.7^Reads in values that are members of Read. Provides a generic error message if the read fails.8ÈReads in values that are members of Read, but the value does not have to appear on the command line. Provides a generic error message if the read fails. If the argument is Nothing, returns Nothing.†+Create an error message from an InputError.9ÿkParses a single command line option. Examines all the options specified using multiple OptSpec and parses one option on the command line accordingly. Fails without consuming any input if the next word on the command line is not a recognized option. Allows the user to specify the shortest unambiguous match for long options; for example, the user could type --verb for  --verbose and --vers for  --version.£This function is applied to a list of OptSpec, rather than to a single OptSpec, because in order to correctly handle the parsing of shortened long options (e.g. --verb rather than  --verbose£) it is necessary for one function to have access to all of the OptSpec. Applying this function multiple times to different lists of OptSpec and then using the  |S function to combine them will break the proper parsing of shortened long options.-For an example that uses this function, see Multiarg.SimpleParser.‡}Parses a short option without an argument, either pending or non-pending. Fails with a single error message rather than two.ˆ©Finds the unambiguous short match for a string, if there is one. Returns a string describing the error condition if there is one, or the matching result if successful.:Formats error messages for nice display. Returns a multi-line string (there is no need to append a newline to the end of the string returned).(&'()*+,-./0123456‰Š78†#The option with the faulty argument!The faulty command line arguments9‹ŒŽ‡‘’“”•–ˆ:UPass the name of your program here. Displayed at the beginning of the error message.—˜&'()*+,-./0123456789:612345.0/78&-,+*)('9:&-,+*)('.0/123456‰Š78†9‹ŒŽ‡‘’“”•–ˆ:—˜ Safe-Inferred;lThe name of the program that was entered on the command line, obtained from System.Environment.getProgName.<Specifies a mode.=:How the user specifies the mode on the command line. For git for example this might be commit or log.>8Specification for both options and positional arguments.CSpecifies a set of options.E.Shortcut options are commonly options such as --help or  --versionÿu. Such options must be specified alone on the command line. The parser looks for one of these options first. If it finds one and it is the only option on the command line, only this option is processed and returned. If the option is not alone on the command line, an error occurs. If no shortcut option is found, the parser processes non-shortcut options instead.F`If the user does not specify any shortcut options, she may specify any number of these options.GŸWhat to do after encountering the first non-option, non-option-argument word on the command line? In either case, no more options are parsed after a stopper.HhNo additional options will be parsed after encountering the first positional argument. For example, if a and b# are options, in the command line  -a posarg -b, bC will be parsed as a positional argument rather than as an option.IvAdditional options are allowed on the command line after encountering the first positional argument. For example, if a and b" are options, in the command line  -a posarg -b, b" will be parsed as an option. If b is not7 an option and the same command line is entered, then -b" will result in an error because -b< starts with a hyphen and therefore "looks like" an option.J,Creates an Opts with a help shortcut option.K7Creates an Opts with help and version shortcut options.LCreates a mode.M@Changes the mode name that a user specifies on the command line.N>Creates a Mode with a help option (help specific to the mode.)O`A pure (non-IO) parser for simple command lines--that is, command lines that do not have modes.P<A pure (non-IO) parser for command lines that contain modes.QSA parser for simple command lines that do not contain modes. Runs in the IO monad.RKA command line parser for multi-mode command lines. Runs in the IO monad.S*A parser for simple command lines. Adds a --help option for you.TDA parser for simple command lines without modes. Adds options for --help and  --version for you.™ÿLHandles positional arguments and errors with them. The parser for the positional argument must be passed in (this way it can be parsed with nonOptionPosArg or nextWord, as appropriate; when parsing interpsersed command lines, you will want nonOptionPosArg; when parsing non-interspersed command lines, you will need nextWord.)šÿ"Parses options only, where they are not interspersed with positional arguments. Stops parsing only where it encouters a word that does not begin with a dash. This way if the user enters a bad option, it shows in the error message as a bad option rather than simply not getting parsed.›¹Parses options and positional arguments where the two are not interspersed. Stops parsing options when a stopper is encountered or at the first word that does not look like an option.œparseIntersperse o p¦ parses options and positional arguments, where o is a parser that parses options, and p is a function that, when applied to a string, returns the appropriate type.ÿIf a stopper has not yet been seen, any word that begins with a hyphen will not be parsed as a positional argument. Therefore, if there is a word before a stopper and it begins with a hyphen, if it is not a valid option then the parse will fail with an error.kLooks at the next word. Succeeds if it is a non-option, or if we are at the end of input. Fails otherwise./;<ž=Ÿ>?@ABCDEFGHIJ&Whatever type you wish to use for helpKWhat you wish to use for help What you wish to use for versionL:How the user specifies the mode on the command line. For git for example this might be commit or log.dOptions and positional arguments that are specific to this mode. For example, in the command line )git commit -a -m 'this is a log message', commit‚ is the mode name and everything after that is specified here as an option or positional argument that is specific to this mode.âThis function is applied to a list of the results of parsing the options that are specific to this mode. The function returns a type of your choosing (though all modes in the same parser will have to return the same type.)M:This function is applied to the existing name of the mode.N Mode nameØWhatever you want to use for the help (perhaps a string, or a function, or an IO action). Its type will have to match up with the type of the global shortcut options and with the shortcut type of the other modes.9When applied to the the mode options, returns the result.Options for this mode=Allow interspersion of mode options and positional arguments?Parses positional arguments ¡¢£O¹Specifies allowed regular options, allowed shortcut options, and how to parse positional arguments. Also specifies whether the user may intersperse options with positional arguments.#The command line arguments to parseÿ8Returns an error if the command line arguments could not be parsed. If the parse was successful, returns an Either. A Left indicates that the user selected a shortcut option. A Right indicates that the user did not specify a shortcut option, and will contain a list of the options and positional arguments.PUGlobal options. These are specified before any mode. For instance, in the command git --no-pager commit -a, the option  --no-pagerS is a global option. Global options can contain shortcut options. For instance,  git --help$ contains a single shortcut option.ÿFThis function processes the global options. If there are no shortcut options specified in the global options, it is applied to the result of processing the global options. This function may return a Left if there is something wrong with the global options (a nonsensical combination, perhaps.) Otherwise, it returns a  Right Either“. Return a Left if there is no need to process any modes at all after seeing the global options. Otherwise, return a Right with a list of modes.Command line arguments to parse€If the command line arguments fail to parse, this will be a Left with the error. If the parser is successful, this returns a  Right Eitherµ. A Left indicates that the user entered a shortcut option, either in the global options or in one of the mode-specific options. A Right indicates that the user selected a mode.QOptions to parse-Allow interspersion of options and arguments?!How to parse positional arguments‹If there is an error parsing the command line, the program will exit with an error message. If successful the results are returned here.¤R4Specifies global options and global shortcut optionsÿFThis function processes the global options. If there are no shortcut options specified in the global options, it is applied to the result of processing the global options. This function may return a Left if there is something wrong with the global options (a nonsensical combination, perhaps.) Otherwise, it returns a  Right Either“. Return a Left if there is no need to process any modes at all after seeing the global options. Otherwise, return a Right with a list of modes.úIf parsing fails, the program will exit with a failure. If successful, the result is returned here. A Left indicates a shortcut option, either from the global options or from the mode-specific options; a Right indicates the mode a user selected.¥¦§S‹Indicate the help here. This function, when applied to the name of the program, returns help. simpleHelp automatically adds options for --help and -h for you.Options to parse8Allow interspersion of options and positional arguments?!How to parse positional argumentsÖIf the parser fails, the program will exit with an error. If the user requested help, it will be displayed and the program exits successfully. Otherwise, the options and positional arguments are returned here.T’Indicate the help here. This function, when applied to the name of the program, returns help. simpleHelpVersion automatically adds options for --help and -h for you.£Indicate the version here. This function, when applied to the name of the program, returns a version string. simpleHelpVersion automatically adds an option for  --version for you.Options to parse8Allow interspersion of options and positional arguments?!How to parse positional argumentsíIf the parser fails, the program will exit with an error. If the user requested help or version information, it will be displayed and the program exits successfully. Otherwise, the options and positional arguments are returned here.™,Parser for Word for next positional argument'Function to handle positional argumentsš›œ¨©ª«¬­;<=>?@ABCDEFGHIJKLMNOPQRSTGIH;CDEF>?@AB<=L=MOQSTPRJKN#;<ž=Ÿ>?@ABCDEFGIHJKLMN ¡¢£OPQ¤R¥¦§ST™š›œ¨©ª«¬­ Safe-InferredUVWXYZ[\]^_`abcUVWXYZ[\]^_`abcUa`_^]\[ZYXWVbcU a`_^]\[ZYXWVbc Safe-Inferred_®¯°±²³´µ¶·  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRST¸ !"#$%&'()*+,-./0123456789:;<=>?@AABCDEFGHIJKLLMNOPPQRSTSUVWXYZ[\]^_`abcdefghijklmnopqrpqsptuvpwxyz{z|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§J¨©ª«¬­®¯°±²³´µ¶p ·p ¸p ¹p ºp »p ¼p ½p ¾p p¿ÀÁmultiarg-0.28.0.0Multiarg.Option Multiarg.PrimMultiarg.CombinatorMultiarg.CommandLineMultiarg.SampleParser formatErrorControl.Monad.MonadreturnControl.Applicative.ApplicativepurefailSystem.EnvironmentgetArgsSystem.Console.GetOptArgDescrMultiargLongOpt unLongOptShortOpt unShortOpt makeShortOpt makeLongOptError DescriptionExpectedGeneralUnknown InputDescParsergoodbind failString genericThrowchoiceseveral1severalparsependingShortOpt lookAheadnonPendingShortOpt exactLongOpt approxLongOptpendingShortOptArgstopper resetStoppertrynextWord nextWordIsnonOptionPosArgendmatchApproxWordmanyTillArgSpec ChoiceArg VariableArgThreeArgTwoArgOneArg OptionalArgNoArg InputErrorErrorMsgNoMsgOptSpeclongOpts shortOptsargSpec notFollowedByreader optReader parseOptionProgNameMode mModeNameOptsWithPosArgsopOpts opIntersperseopPosArgOpts oShortcutsoOptions Intersperse StopOptionsoptsHelpoptsHelpVersionmode renameModemodeHelp simplePure modesPuresimpleIOmodesIO simpleHelpsimpleHelpVersionFlagFilenameVersionHelpVerboseSleepQuietPidStatsLinesRetryFollowBytesspecs sampleMainisValidLongOptTextbaseGHC.Base>>=MonadControl.Applicative AlternativecrashOnEmptyOkGHC.Errerror splitLongWordConsumedEmptyReplyFailOkState SawStopper Remaining PendingShort runParser descLocationnextW getLongOptionapproxLongOptErrorassert fromMaybe$fMonadPlusParser$fMonoidParser$fAlternativeParser$fApplicativeParser$fFunctorParser $fMonadParsererrorMsg nextShort matchAbbrevunsafeShortOpt unsafeLongOpt longOptParser longOptSet longOptMaplongOptshortOptshortVariableArg shortOneArg firstShortArgshortChoiceArg shortTwoArg shortThreeArgshortOptionalArg$fFunctorArgSpec$fFunctorOptSpec parsePosArgparseOptsNoIntersperse parseStopOptsparseIntersperse endOrNonOptmParser parseOptsparseOptsWithPosArgs processMode parseModessimpleIOCustomError displayActerrorActerrorActDisplayHelp $fFunctorMode$fBifunctorMode$fFunctorOptsWithPosArgs$fBifunctorOptsWithPosArgs $fFunctorOpts$fBifunctorOptsgetEnvironment withProgNamewithArgsunsetEnvsetEnv lookupEnvgetEnv getProgName!System.Environment.ExecutablePathgetExecutablePath