s|f`      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ 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 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. `ab`ab Safe-Inferred?Error messages. To format error messages for nice display, see  . ?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 c in  d.  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 e. fApplies g1 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 hCTakes 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. 9ijklmn opqrs tuvfUse this label when applying g ?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. wxhy !"#$%z{|}~   !"#$% % !"$#  .ikjlnm opqrs tuvfwxhy !"#$%z{|}~ 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. 6Some of these value constructors have names ending in E. Use E these constructors when you want to parse option arguments that may D fail to parse--for example, you want to parse an Int. The function E passed as an argument to the value constructor indicates failure by  returing an  Exception. )7This option takes a variable number of arguments, like  /'. Parsing of the arguments might fail. *(This option takes three arguments, like 0 . Parsing  of the arguments might fail. +&This option takes two arguments, like 1 . Parsing of  the arguments might fail. ,*This option takes a single argument, like 2 . Parsing  of the argument might fail. --This option takes an optional argument, like  3/. Parsing of the optional argument might fail. .=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. 07This option takes three arguments. Parsed similarly to  2. 15This option takes two arguments. Parsed similarly to  2. 20This 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. 34This 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 :) 4This option takes no arguments 54Indicates errors when parsing options to arguments. 6@Parsing 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 C automatically prepended to the error message, so do not replicate  this in your message. 7@No error message accompanies this failure. multiarg will create " a generic error message for you. 8Specifies options for the @ function. Each OptSpec % represents one command-line option. :-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. ;,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. <6What to do each time one of the given long options or , short options appears on the command line. =notFollowedBy 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. >=Reads in values that are members of Read. Provides a generic " error message if the read fails. ?AReads 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. @>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. =Parses a short option without an argument, either pending or A non-pending. Fails with a single error message rather than two. <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. A>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). 2()*+,-./0123456789:;<=>?$The option with the faulty argument "The faulty command line arguments @A?Pass the name of your program here. Displayed at the beginning  of the error message. ()*+,-./0123456789:;<=>?@A=89:;<576>?(43210/.-,+*)@A ( 43210/.-,+*)57689:;<=>?@A Safe-InferredB:Provides information on each mode that you wish to parse. D:How the user identifies the mode on the command line. For  example, with git this would be commit, pull, etc. E9Each mode may have options and positional arguments; may  these be interspersed? FOptions for this mode G6How to parse positional arguments for this mode. This @ function shall return an Exception if something was wrong with + the argument, or a Success if it is okay. H3Processes the options after they have been parsed. I0Help string for this mode. This is used only in  P; O$ ignores this. This is displayed on ; screen exactly as is, so be sure to include the necessary > trailing newline. The function is applied to the name of the * program (which is retrieved at runtime.) 2Wraps the OptSpec passed into to simpleWithHelp. J4What 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. K<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. L9Additional 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. MParse 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. 9Shows help and exits successfully if that was requested; 5 otherwise, returns the parsed command line options. NAParses a simple command line (that is, one without modes) in the , IO monad. Gets the arguments for you using getArgs. In addition " to the arguments you provide for M, you also provide online  help. This function adds -h and --help options and shows help B if the user entered one of these options anywhere on the command < line. If help is shown, the program exits successfully. In D addition, it will print a message to standard error if parsing the 2 command line fails and then exit unsuccessfully. +Display a simple enter-h-for-help message. O=Parses a command line that may feature options followed by a ? mode followed by more options and then followed by positional  arguments. PLike O2, but runs in the IO monad. Gets the command line 4 arguments for you. This function adds the options -h and  --help9, both in the global options and in the options for each  mode. If -h or --help' is entered in the global options, the E global help is shown and the program exits successfully; similarly, 6 if help is requested for a particular mode, that mode' s help is + shown and the program exits successfully. CIf an error occurs in the processing of the command line, an error : message is printed and the program exits with a failure. ALooks at the next word. Succeeds if it is a non-option, or if we + are at the end of input. Fails otherwise. %BCDEFGHIJKLM<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 A positional argument. This function shall return an Exception if > something was wrong with the argument, or a Success if it is  okay. ;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. N@Help message. Printed as is, so it can be one line or have many B lines. It should however have a final end-of-line character. The : function is applied to the name of the program (which is  retrieved at runtime.) <What to do after encountering the first positional argument #All possible options. Do not add a -h or --help option;  these are added for you. @How to handle positional arguments. This function is applied to ; the appropriate string every time the parser encounters a A positional argument. This function shall return an Exception if > something was wrong with the argument, or a Success if it is  okay. 9If help is requested, the program will print it and exit C successfully. If there was an error parsing the command line, the . program will print an error message and exit ? unsuccessfully. Otherwise, the parsed arguments are returned.  Program name  Program name  Global help  Program name O=Global options. These come after the program name but before  the mode name. ;This function will be applied to the result of parsing the , global options. The function must return a Left if you do not B want to parse any modes at all. This can be useful if one of the # global options was something like --help or  --version and so ? you do not need to see any mode. The function returned in the  Left9 will be applied to a list of all remaining command-line % arguments after the global options. +The command line to parse (presumably from getArgs) >Returns an Exception if an error was encountered when parsing @ any part of the command line (either the global options or the ' mode.) Otherwise, returns the result. P?Global help. This is a function that, when applied to the name @ of the program (which is retrieved at runtime), returns a help @ string. This is output exactly as is, so include any necessary  trailing newlines. =Global options. These come after the program name but before ' the mode name. Do not add options for -h or --help ; these are  added automatically. ;This function will be applied to the result of parsing the , global options. The function must return a Left if you do not B want to parse any modes at all. This can be useful if one of the # global options was something like  --version and so ? you do not need to see any mode. The function returned in the  Left9 will be applied to a list of all remaining command-line % arguments after the global options. BCDEFGHIJKLMNOPJLKMNBCDEFGHIOPBCDEFGHIJLKMNOP Safe-InferredQRSTUVWXYZ[\]^_QRSTUVWXYZ[\]^_Q]\[ZYXWVUTSR^_Q ]\[ZYXWVUTSR^_ Safe-Inferred|  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOP !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIIJKLMNOPQQRSTUVWXYXZ[\]^_`abcdefghijklmnopnoqnrstnuvwxyxz{|}}~multiarg-0.16.0.0System.Console.MultiArg.OptionSystem.Console.MultiArg.PrimSystem.Console.MultiArg.GetArgs"System.Console.MultiArg.Combinator$System.Console.MultiArg.SimpleParser$System.Console.MultiArg.SampleParser formatErrorControl.Monad.MonadreturnControl.Applicative.ApplicativepurefailSystem.EnvironmentgetArgsSystem.Console.GetOptArgDescrSystem.Console.MultiArgGetArgsLongOpt unLongOptShortOpt unShortOpt makeShortOpt makeLongOptError DescriptionExpectedGeneralUnknown InputDescParsergoodbind failString genericThrowchoiceseveral1severalparsependingShortOpt lookAheadnonPendingShortOpt exactLongOpt approxLongOptpendingShortOptArgstopper resetStoppertrynextWord nextWordIsnonOptionPosArgendmatchApproxWordmanyTill getProgNameArgSpec VariableArgE ThreeArgETwoArgEOneArgE OptionalArgE ChoiceArg VariableArgThreeArgTwoArgOneArg OptionalArgNoArg InputErrorErrorMsgNoMsgOptSpeclongOpts shortOptsargSpec notFollowedByreader optReader parseOptionModemName mInterspersemOptsmPosArgsmProcessmHelp Intersperse StopOptionssimplesimpleWithHelpmodes modesWithHelpFlagFilenameVersionHelpVerboseSleepQuietPidStatsLinesRetryFollowBytesspecs sampleMainisValidLongOptTextbaseGHC.Base>>=MonadControl.Applicative AlternativecrashOnEmptyOkGHC.Errerror splitLongWordConsumedEmptyReplyFailOkState SawStopper Remaining PendingShort runParser descLocationnextW getLongOptionapproxLongOptError$fMonadPlusParser$fMonoidParser$fAlternativeParser$fApplicativeParser$fFunctorParser $fMonadParsererrorMsg nextShort matchAbbrevunsafeShortOpt unsafeLongOpt longOptParser longOptSet longOptMaplongOptshortOptshortVariableArgshortVariableArgE shortOneArg shortOneArgE firstShortArgshortChoiceArg shortTwoArg shortTwoArgE shortThreeArgshortThreeArgEshortOptionalArgshortOptionalArgE$fFunctorArgSpec$fFunctorOptSpecArgWrapparseIntersperse extractOpts enterForHelp endOrNonOptDoHelp ArgWrapResultNoHelp NeedsHelpOtherArgHelpArgparseOptsNoIntersperse parsePosArg parseStopOpts partitionHelpmodesWithHelpPure modesNoHelpprocessModeWithHelpprocessModeNoHelp addHelpOpt $fFunctorMode$fFunctorArgWrapexplicit-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