>5dS      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQR Safe-Inferred?Long options. Options that are preceded with two dashes on the E command line and typically consist of an entire mnemonic word, such  as lines8. However, anything that is at least one letter long is ? fine for a long option name. The name must not have a dash as B either the first or second character and it 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 E the command line and consist of a single letter. That single letter B cannot be a dash. Any other Unicode character is good (including # pathological ones like newlines). @Creates a short option. Returns Nothing if the character is not  valid for a short option. BMakes a long option. Returns Nothing if the string is not a valid  long option. STUSTU Safe-Inferred ?Parsers. Internally the parser tracks what input remains to be D parsed, whether there are any pending short options, and whether a 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 C fail; a failed parser affects the behavior of combinators such as  choice. good a5 always succeeds without consuming any input and has 0 result a. This provides the implementation for   and    . ACombines 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, B 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. =If the first parser fails, combine will not apply the second 5 function but instead will bypass the second parser. %This provides the implementation for V in  W.  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  throwString is < more useful, but this is handy to implement some typeclass  instances. @Runs the first parser. If it fails without consuming any input, A then runs the second parser. If the first parser succeeds, then C 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 X. YApplies Z1 if a parser would succeed without consuming any = input. Useful for preventing infinite loops on parsers like  . ?Runs 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 A 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 a! (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 C pending short options. Fails without consuming any input if there C is a pending short option, but it does not match the short option C given. Succeeds and consumes a pending short option if it matches  the short option given.  lookAhead p4 runs parser p. If p succeeds, lookAhead p succeeds ? without consuming any input. If p fails without consuming any D input, so does lookAhead. If p fails and consumes input, lookAhead E also fails and consumes input. If this is undesirable, combine with  try. ?Parses 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 dash ; the next argument is a short option but it does not match  the one given  the next argument is a stopper BOtherwise, consumes the next argument, puts any remaining letters D from the argument into a pending short, and removes the first word ( from remaining arguments to be parsed. 6Parses an exact long option. That is, the text of the 8 command-line option must exactly match the text of the 2 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 D 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 E 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 options  a stopper has been parsed 1 there are no arguments left on the command line ; the 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 5 dashes but its text does not match the argument we're looking for [CTakes a single String and returns a tuple, where the first element E is the first two letters, the second element is everything from the E third letter to the equal sign, and the third element is Nothing if B 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 C unambiguously, returns a tuple of the word actually found and the D matching word in the set and the accompanying text after the equal C sign (if any). If the Set is empty, this parser will always fail. AParses only pending short option arguments. For example, for the  tail" command, if you enter the option -c25, then after parsing  the -c option the 25) becomes a pending short option argument 9 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 arguments DOn success, returns the String of the pending short option argument $ (this String will never be empty).  Parses a "stopper"0 - that is, a double dash. Changes the internal > state of the parser to reflect that a stopper has been seen. >If a stopper has already been seen, change the internal state 3 back to indicating that no stopper has been seen. Btry p behaves just like p, but if p fails, try p will not consume  any input. AReturns the next string on the command line as long as there are B no pendings. Succeeds even if a stopper is present. Be careful - B this will return the next string even if it looks like an option B (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. !AParses the next word on the command line, but only if it exactly @ matches the word given. Otherwise, fails without consuming any D input. Also fails without consuming any input if there are pending E short options or if a stopper has already been parsed. Does not pay 0 any attention to whether a stopper is present. "GIf there are pending short options, fails without consuming any input. BOtherwise, if a stopper has NOT already been parsed, then returns D the next word if it is either a single dash or any other word that B does not begin with a dash. If the next word does not meet these . criteria, fails without consuming any input. BOtherwise, 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, B then get the next word and see if it matches one of the words in D 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 end/ runs parser p zero or more times until parser  end succeeds. If end, 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,  manyTill6 fails and consumes input. If that is a problem, wrap  end in try. 9\]^_`a bcdef ghiYUse this label when applying Z ?Command line arguments to parse. Presumably you got these from  getArgs2. If there is any chance that you will be parsing + Unicode strings, see the documentation in  System.Console.MultiArg.GetArgs before you use    . Parser to run <Success or failure. Any parser might fail; for example, the B command line might not have any values left to parse. Use of the  , combinator can lead to a list of failures. jk[l !"#$%mnopqr   !"#$% % !"$#  .\^]_a` bcdef ghiYjk[l !"#$%mnopqr Safe-Inferred&7Gets the command-line arguments supplied by the program's  user. If the base. package is older than version 4.4, then this A function assumes the command line is encoded in UTF-8, which is C true for many newer Unix systems; however, many older systems may > use single-byte encodings like ISO-8859. In such cases, this ' function will give erroneous results. If the base2 package is version 4.4.0 or newer, this function ) simply uses the getArgs that comes with base. That getArgs  detects the system'/s default encoding and uses that, so it should ( give accurate results on most systems. '8Gets the name of the program that the user invoked. See  documentation for &' for important caveats that also apply  to this function. &'&'&'&' Safe-Inferred(8Specifies how many arguments each option takes. As with  #, there are (at least) two ways to D use this type. You can simply represent each possible option using C different data constructors in an algebraic data type. Or you can E have each ArgSpec yield a function that transforms a record. For an / example that uses an algebraic data type, see  $System.Console.MultiArg.SampleParser. )=This option takes a single argument, which must match one of A the strings given in the list. The user may supply the shortest ; unambiguous string. If the argument list to ChoiceArg has A duplicate strings, only the first string is used. For instance, 3 ChoiceArg could be useful if you were parsing the --color > 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 A 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  -a; 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. +7This option takes three arguments. Parsed similarly to  -. ,5This 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. .4This 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 a. 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 0Specifies options for the 6 function. Each OptSpec % represents one command-line option. 2-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 C specify the long option here. Strings you specify as long options 9 cannot include a dash as either the first or the second ? character, and they cannot include an equal sign anywhere. If B your long option does not meet these conditions, a runtime error  will occur. 3,Each Char is a single short option, such as v. The C character cannot be a dash; if it is, a runtime error will occur. 46What to do each time one of the given long options or , short options appears on the command line. 5notFollowedBy p. succeeds only if parser p fails. If p fails, C notFollowedBy succeeds without consuming any input. If p succeeds B and consumes input, notFollowedBy fails and consumes input. If p B succeeds and does not consume any input, notFollowedBy fails and  does not consume any input. 6>Parses a single command line option. Examines all the options ? specified using multiple OptSpec and parses one option on the D command line accordingly. Fails without consuming any input if the B 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 E 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 C OptSpec. Applying this function multiple times to different lists  of OptSpec and then using the  | function to combine them will 5 break the proper parsing of shortened long options. ,For an example that uses this function, see  $System.Console.MultiArg.SimpleParser. s=Parses a short option without an argument, either pending or A non-pending. Fails with a single error message rather than two. t<Finds the unambiguous short match for a string, if there is B one. Returns a string describing the error condition if there is , one, or the matching result if successful. 7)Formats error messages for nice display. "()*+,-./012345uv6wxyz{s|}~t7?Pass the name of your program here. Displayed at the beginning  of the error message. ()*+,-./01234567501234(/.-,+*)67(/.-,+*)012345uv6wxyz{s|}~t7 Safe-Inferred 8:Provides information on each mode that you wish to parse. ::How the user identifies the mode on the command line. For  example, with git this would be commit, pull, etc. ;9Each mode may have options and positional arguments; may  these be interspersed? <Options for this mode =0How to parse positional arguments for this mode >3Processes the options after they have been parsed. ?4What to do after encountering the first non-option, B non-option-argument word on the command line? In either case, no * more options are parsed after a stopper. @<No 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, b will be parsed 4 as a positional argument rather than as an option. A9Additional 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 not 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. BParse a command line. parseIntersperse o p* parses options and positional arguments, D where o is a parser that parses options, and p is a function that, 9 when applied to a string, returns the appropriate type. C=Parses a command line that may feature options followed by a ? mode followed by more options and then followed by positional  arguments. ALooks at the next word. Succeeds if it is a non-option, or if we + are at the end of input. Fails otherwise. 89:;<=>?@AB<What to do after encountering the first positional argument All possible options @How to handle positional arguments. This function is applied to ; the appropriate string every time the parser encounters a  positional argument. ;The command line to parse. This function correctly handles # Unicode strings; however, because    ? does not always correctly handle Unicode strings, consult the  documentation in  and consider C using the functions in there if there is any chance that you will 7 be parsing command lines that have non-ASCII strings. C=Global options. These come after the program name but before  the mode name. 9This function is applied to all the global options after = they are parsed. To indicate a failure, return an Exception ? String; otherwise, return a successful value. This allows you > to process the global options before the mode is parsed. (If  you don'%t need to do any preprocessing, pass return here.) = If you indicate a failure here, parsing of the command line 4 will stop and this error message will be returned. ;This function determines whether modes will be parsed and, = if so, which ones. The function is applied to the result of > the pre-processing of the global options, so which modes are > parsed and the behavior of those modes can vary depending on ? the global options. Return a Left to indicate that you do not @ want to parse modes at all. For instance, if the user passed a  --help3 option, you may not want to look for a mode after @ that. Otherwise, to parse modes, return a Right with a list of  the modes. +The command line to parse (presumably from getArgs) 6Returns an Exception if an error was encountered when ; parsing the command line (including if the global options 7 procesor returned an Exception.) Otherwise, returns a : pair. The first element of the pair is the result of the @ global options processor. The second element of the pair is an @ Either. It is Left if no modes were parsed, with a list of the @ positional arguments. It is a Right if modes were parsed, with 2 the result of parsing the arguments to the mode. 89:;<=>?@ABC ?A@B89:;<=>C 89:;<=>?A@BC Safe-InferredDEFGHIJKLMNOPQRDEFGHIJKLMNOPQRDPONMLKJIHGFEQRD PONMLKJIHGFEQR Safe-Inferredo  !"#$%&'()*+,-./0123456789:;<=>?@ABC !"#$%&'()*+,-./0123456 789:;<=>?@@ABCDEFGGHIJKLMNMOPQRSTUVWXYZ[\]^_`abcabdaefgahijklkmnoppqrstuvwxyz{|}~multiarg-0.8.0.0System.Console.MultiArg.OptionSystem.Console.MultiArg.PrimSystem.Console.MultiArg.GetArgs"System.Console.MultiArg.Combinator$System.Console.MultiArg.SimpleParser$System.Console.MultiArg.SampleParserControl.Monad.MonadreturnControl.Applicative.ApplicativepurefailSystem.EnvironmentgetArgsSystem.Console.GetOptArgDescrSystem.Console.MultiArgGetArgsLongOpt unLongOptShortOpt unShortOpt makeShortOpt makeLongOptError DescriptionExpectedGeneralUnknown InputDescParsergoodbind failString genericThrowchoiceseveral1severalparsependingShortOpt lookAheadnonPendingShortOpt exactLongOpt approxLongOptpendingShortOptArgstopper resetStoppertrynextWord nextWordIsnonOptionPosArgendmatchApproxWordmanyTill getProgNameArgSpec ChoiceArg VariableArgThreeArgTwoArgOneArg OptionalArgNoArgOptSpeclongOpts shortOptsargSpec notFollowedBy parseOption formatErrorModemName mInterspersemOptsmPosArgsmProcess Intersperse StopOptionssimplemodesFlagFilenameVersionHelpVerboseSleepQuietPidStatsLinesRetryFollowBytesspecs sampleMainisValidLongOptTextbaseGHC.Base>>=MonadControl.Applicative AlternativecrashOnEmptyOkGHC.Errerror splitLongWordConsumedEmptyReplyFailOkState SawStopper Remaining PendingShort runParser descLocationnextW getLongOptionapproxLongOptError$fMonadPlusParser$fMonoidParser$fAlternativeParser$fApplicativeParser$fFunctorParser $fMonadParser nextShort matchAbbrevunsafeShortOpt unsafeLongOpt longOptParser longOptSet longOptMaplongOptshortOptshortVariableArg shortOneArg firstShortArgshortChoiceArg shortTwoArg shortThreeArgshortOptionalArg$fFunctorArgSpec$fFunctorOptSpecparseIntersperse endOrNonOptparseOptsNoIntersperse parseStopOptsprocessModeArgs $fFunctorModeexplicit-exception-0.1.7.1#Control.Monad.Exception.SynchronousmergeT manyMonoidTmanyTtryTresolveTbracketTcatchTassertTthrowTmapExceptionalT mapExceptionTforceTswitchT fromExitCodeT toExitCodeT toEitherT fromEitherTtoErrorT fromErrorTtoMaybeT fromMaybeTmergeresolvecatchassertthrowmapExceptional mapExceptionforceswitchgetExceptionNull fromExitCode toExitCodetoEithertoMaybe fromEither fromMaybeSuccess Exception ExceptionalrunExceptionalT ExceptionalT