ϊΞ°όrA      !"#$%&'()*+,-./0123456789:;<=>?@ Safe-InferedABCDEABCDEABCDE Safe-InferedFGHIJKLMNOPQRSTUVWFGHIJKLMNOPQRSTUVWFGHIJKLMNOPQRSTUVW Safe-InferedXYZXXYZNone An option';s type determines how the option will be parsed, and which G Haskell type the parsed value will be stored as. There are many types E available, covering most basic types and a few more advanced types. 9A short title for the group, which is used when printing  --help output. 8A description of the group, which is used when printing  --help output. <Short flags are a single character. When entered by a user, = they are preceded by a dash and possibly other short flags. *Short flags must be a letter or a number. Example: An option with optionShortFlags = ['p'] may be set using: $ ./app -p 443 $ ./app -p443 ALong flags are multiple characters. When entered by a user, they  are preceded by two dashes. )Long flags may contain letters, numbers, '-', and '_'. Example: An option with optionLongFlags = ["port"] may be set using: $ ./app --port 443 $ ./app --port=443 @Options may have a default value. This will be parsed as if the * user had entered it on the command line. @There are many types which an application or library might want > to use when designing their options. By default, options are  strings, but ' may be set to any supported type. See  the " Option types"( section for a list of supported types.  An option'6s description is used with the default implementation  of --help9. It should be a short string describing what the option  does. &Which group the option is in. See the " Option groups" section  for details. Store an option as a [ . The option's value must be either  "true" or "false". IBoolean options are unary, which means that their value is optional when K specified on the command line. If a flag is present, the option is set to  True.   $ ./app -q $ ./app --quiet KBoolean options may still be specified explicitly by using long flags with  the  --flag=value5 format. This is the only way to set a unary flag to  "false". $ ./app --quiet=true $ ./app --quiet=false Store an option value as a \". The value is decoded to Unicode J first, if needed. The value may contain non-Unicode bytes, in which case " they will be stored using GHC 7.4'"s encoding for mixed-use strings. Store an option value as a ]". The value is decoded to Unicode M first, if needed. If the value cannot be decoded, the stored value may have $ the Unicode substitution character '\65533' in place of some of the  original input. Store an option value as a ^. Store an option as an _&. The option value must be an integer n  such that ` <= n <= a. Store an option as an b&. The option value must be an integer n  such that ` <= n <= a. Store an option as an c&. The option value must be an integer n  such that ` <= n <= a. Store an option as an d&. The option value must be an integer n  such that ` <= n <= a. Store an option as an e&. The option value must be an integer n  such that ` <= n <= a. Store an option as a f&. The option value must be a positive  integer n such that 0 <= n <= a. Store an option as a g&. The option value must be a positive  integer n such that 0 <= n <= a. Store an option as a h&. The option value must be a positive  integer n such that 0 <= n <= a. Store an option as a i&. The option value must be a positive  integer n such that 0 <= n <= a. Store an option as a j&. The option value must be a positive  integer n such that 0 <= n <= a. Store an option as an k'. The option value must be an integer. ' There is no minimum or maximum value. Store an option as a l,. The option value must be a number. Due to L the imprecision of floating-point math, the stored value might not exactly  match the user's input. If the user' s input is out of range for the  l type, it will be stored as Infinity or  -Infinity. Store an option as a m,. The option value must be a number. Due to L the imprecision of floating-point math, the stored value might not exactly  match the user's input. If the user' s input is out of range for the  m type, it will be stored as Infinity or  -Infinity. Store an option as a n$ of another type. The value will be  Nothing7 if the option was not provided or is an empty string.  option " optTimeout" (\o -> o  {  = ["timeout"]  ,  =    }) Store an option as a o$, using another option type for the J elements. The separator should be a character that will not occur within + the values, such as a comma or semicolon. /Duplicate elements in the input are permitted.  option "optNames" (\o -> o  {  = ["names"]  ,  = "Alice;Bob;Charles"  ,  =  ';'    }) Store an option as a p,, using other option types for the keys and  values. *The item separator is used to separate key/value pairs from eachother. It M should be a character that will not occur within either the keys or values. JThe value separator is used to separate the key from the value. It should M be a character that will not occur within the keys. It may occur within the  values. KDuplicate keys in the input are permitted. The final value for each key is  stored.  option "optNames" (\o -> o  {  = ["names"]  ,  = "name=Alice;hometown=Bucharest"  ,  =  ';' '='      }) GStore an option as a list, using another option type for the elements. L The separator should be a character that will not occur within the values,  such as a comma or semicolon.  option "optNames" (\o -> o  {  = ["names"]  ,  = "Alice;Bob;Charles"  ,  =  ';'    })  AStore an option as one of a set of enumerated values. The option * type must be defined in a separate file.  -- MyApp/Types.hs data Mode = ModeFoo | ModeBar  deriving (Enum)    -- Main.hs import MyApp.Types   defineOptions " MainOptions" $ do  option "optMode" (\o -> o  {  = ["mode"]  ,  = "foo"  ,  =   ''Mode  [ ("foo" , ModeFoo)  , ("bar" , ModeBar)  ]  })  $ ./app Running in mode ModeFoo $ ./app --mode=bar Running in mode ModeBar 0qrst u vwxyz{Element separator  Element type Item separator Key/Value separator  Key type  Value type |}~Element separator  Element type 0qrst u vwxyz{|}~ $qrst u vwxyz{|}~ None€‚ƒ„…†€‚ƒ„…†€ƒ‚„…†None"See ?. #See <. $See < and ?. &EOptions are defined together in a single data type, which will be an  instance of &. See (& for details on defining instances of &. See *# for details on including imported & types in locally  defined options. 'EAn options value containing only the default values for each option. H This is equivalent to the options value when parsing an empty argument  list. (FDefines a new data type, containing fields for application or library . options. The new type will be an instance of &. Example: this use of  defineOptions:   ( " MainOptions" $ do  - " optMessage" "message" " Hello world!" ""  , "optQuiet" "quiet" False "" %expands to the following definition: data MainOptions = MainOptions  { optMessage :: String  , optQuiet :: Bool  }  instance Options MainOptions )2Defines a new option in the current options type. All options must have a  field name and one or more flags. Options may 7 also have a default value, a description, or a group. EThe field name is how the option will be accessed in Haskell, and is  typically prefixed with "opt"). This is used to define a record field, - and must be a valid Haskell field name (see ( for details). The flagsA are how the user specifies an option on the command line. Flags  may be short or long. See  and  for  details.  ) "optPort" (\o -> o  {  = ["port"]  ,  = "80"  ,  =   } *GInclude options defined elsewhere into the current options definition. LThis is typically used by application developers to include options defined : in third-party libraries. For example, the author of the "foo" library  would define and export  FooOptions:   #module Foo (FooOptions, foo) where  import Options  ( " FooOptions" $ do  , "optFrob" "frob" True "Enable frobnication."  foo :: FooOptions -> IO () +and the author of an application would use options to let users specify  --frob:   module Main where  import Options  import Foo  ( " MainOptions" $ do  , " optVerbose" "verbose" False "Be really loud."  * "optFoo" (+ :: % FooOptions)  main :: IO () main = runCommand $ \opts args -> do  foo (optFoo opts) Use of *; may be arbitrarily nested. Library authors are encouraged I to aggregate their options into a single top-level type, so application @ authors can include it easily in their own option definitions. ,Define an option of type [". This is a simple wrapper around  ). -Define an option of type \". This is a simple wrapper around  ). .Define an option of type [\]". This is a simple wrapper around  ). Items are comma-separated. /Define an option of type ]". This is a simple wrapper around  ). 0Define an option of type []]". This is a simple wrapper around  ). Items are comma-separated. 1Define an option of type ^. This is a simple wrapper  around ). 2Define an option of type _". This is a simple wrapper around  ). 3Define an option of type k". This is a simple wrapper around  ). 4Define an option of type l". This is a simple wrapper around  ). 5Define an option of type m". This is a simple wrapper around  ). 6Define an option group. $Option groups are used to make long --help output more readable, by > hiding obscure or rarely-used options from the main summary. !If an option is in a group named "examples", it will only be shown 2 in the help output if the user provides the flag --help-examples or   --help-all . The flag  --help-all' will show all options, in all groups. 74Get the options value that was parsed from argv, or Nothing if the 0 arguments could not be converted into options. Note: This function return Nothing& if the user provided a help flag. To C check whether an error occured during parsing, check the value of  :. 8JGet command-line arguments remaining after parsing options. The arguments J are unchanged from the original argument list, and have not been decoded  or otherwise transformed. 98Get the subcommand action that was parsed from argv, or Nothing if the 7 arguments could not be converted into a valid action. Note: This function return Nothing& if the user provided a help flag. To C check whether an error occured during parsing, check the value of  :. :BGet the error that prevented options from being parsed from argv,  or Nothing if no error was detected. ;?Get a help message to show the user. If the arguments included ? a help flag, this will be a message appropriate to that flag. + Otherwise, it is a summary (equivalent to --help). CThis is always a non-empty string, regardless of whether the parse C succeeded or failed. If you need to perform additional validation C on the options value, this message can be displayed if validation  fails. <DAttempt to convert a list of command-line arguments into an options J value. This can be used by application developers who want finer control J over error handling, or who want to perform additional validation on the  options value. @The argument list must be in the same encoding as the result of  ‡. Use 7, 8, :, and  ; to inspect the result of <.  Example:  %getOptionsOrDie :: Options a => IO a getOptionsOrDie = do  argv <- System.Environment.getArgs  let parsed = < argv  case 7 parsed of ! Just opts -> return opts  Nothing -> case : parsed of  Just err -> do " hPutStrLn stderr (; parsed) % hPutStrLn stderr err  exitFailure  Nothing -> do  hPutStr stdout (; parsed)  exitSuccess = Retrieve ‡!, and attempt to parse it into a  valid value of an &. type plus a list of left-over arguments. The D options and arguments are then passed to the provided computation. @If parsing fails, this computation will print an error and call  ˆ. /If parsing succeeds, and the user has passed a --help flag, and the M developer is using the default help flag definitions, then this computation # will print documentation and call ‰. See @$ for details on subcommand support. ?FAttempt to convert a list of command-line arguments into a subcommand K action. This can be used by application developers who want finer control L over error handling, or who want subcommands that run in an unusual monad. @The argument list must be in the same encoding as the result of  ‡. Use 9, :, and ; to inspect the  result of ?.  Example:  >runSubcommand :: Options cmdOpts => [Subcommand cmdOpts (IO a)] -> IO a runSubcommand subcommands = do  argv <- System.Environment.getArgs  let parsed = ? subcommands argv  case 9 parsed of  Just cmd -> cmd  Nothing -> case : parsed of  Just err -> do " hPutStrLn stderr (; parsed) % hPutStrLn stderr err  exitFailure  Nothing -> do  hPutStr stdout (; parsed)  exitSuccess @:Used to run applications that are split into subcommands. Use >; to define available commands and their actions, then pass J them to this computation to select one and run it. If the user specifies F an invalid subcommand, this computation will print an error and call  ˆ". In handling of invalid flags or --help, @  acts like =.   {-# LANGUAGE TemplateHaskell #-}  import Control.Monad (unless) import Options  ( " MainOptions" $ do  , "optQuiet" "quiet" False "Whether to be quiet."  ( " HelloOpts" $ do  - "optHello" "hello" "Hello!" "How to say hello."  ( "ByeOpts" $ do  - "optName" "name" "" "The user's name."  ,hello :: MainOptions -> HelloOpts -> [String] -> IO () ;hello mainOpts opts args = unless (optQuiet mainOpts) $ do  putStrLn (optHello opts)  (bye :: MainOptions -> ByeOpts -> [String] -> IO () 9bye mainOpts opts args = unless (optQuiet mainOpts) $ do  putStrLn (" Good bye " ++ optName opts)  main :: IO () main = @  [ > "hello" hello  , > "bye" bye  ]  $ ./app hello Hello! $ ./app hello --hello='Allo!' Allo!  $ ./app bye  Good bye $ ./app bye --name='John' Good bye John $!"#$%&'() Field name Option definition *+, Field name  Long flag Default value Description in --help - Field name  Long flag Default value Description in --help . Field name  Long flag Default value Description in --help / Field name  Long flag Default value Description in --help 0 Field name  Long flag Default value Description in --help 1 Field name  Long flag Default value Description in --help 2 Field name  Long flag Default value Description in --help 3 Field name  Long flag Default value Description in --help 4 Field name  Long flag Default value Description in --help 5 Field name  Long flag Default value Description in --help 6 Group name 789:;<=>The subcommand name. The action to run. ?@Š‹ŒA  !"#$%&'()*+,-./0123456789:;<=>?@I&'=!>@(,-./012345%+* )  6$:;#78<"9?$!"#$%&'()*+,-./0123456789:;<=>?@Š‹ŒŽ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLLMMNOPQRSTUUVWXYYZ[\]^_`abcdefgh]^i`jk`jl`mn`mo`mp`mq`rs`rt`ru`rv`rwxyz]^{]^|`}~€‚ƒ„ …†‡ˆ‰Š‹ŒŽ‘’“”•–`—˜`™š`™›œžŸ  options-0.1Options Options.Util Options.TypesOptions.TokenizeOptions.OptionTypes Options.Help OptionTypeGroup groupTitlegroupDescriptionOptionoptionShortFlagsoptionLongFlags optionDefault optionTypeoptionDescription optionGroupoptionTypeBooloptionTypeStringoptionTypeTextoptionTypeFilePath optionTypeIntoptionTypeInt8optionTypeInt16optionTypeInt32optionTypeInt64optionTypeWordoptionTypeWord8optionTypeWord16optionTypeWord32optionTypeWord64optionTypeIntegeroptionTypeFloatoptionTypeDoubleoptionTypeMaybe optionTypeSet optionTypeMapoptionTypeListoptionTypeEnum SubcommandParsedSubcommand ParsedOptionsParsedImportedOptionsdefaultOptions defineOptionsoptionoptionsimportedOptions boolOption stringOption stringsOption textOption textsOption pathOption intOption integerOption floatOption doubleOptiongroup parsedOptionsparsedArgumentsparsedSubcommand parsedError parsedHelp parseOptions runCommand subcommandparseSubcommand runSubcommandstringToGhc704validFieldNamevalidShortFlag validLongFlag hasDuplicates TokensFor OptionInfo optionInfoKeyoptionInfoShortFlagsoptionInfoLongFlagsoptionInfoDefaultoptionInfoUnaryoptionInfoDescriptionoptionInfoGroup GroupInfo groupInfoNamegroupInfoTitlegroupInfoDescriptionOptionDefinitionstokenize$fMonadStateTok $fMonadTokghc-prim GHC.TypesBoolbaseGHC.BaseStringtext-0.11.1.13Data.Text.InternalTextsystem-filepath-0.4.6Filesystem.Path.InternalFilePathIntGHC.EnumminBoundmaxBoundGHC.IntInt8Int16Int32Int64GHC.WordWordWord8Word16Word32Word64 integer-gmpGHC.Integer.TypeIntegerFloatDouble Data.MaybeMaybecontainers-0.4.2.1Data.SetSetData.MapMap groupName parseBool parseText parsePath parseIntegerparseBoundedIntegral parseFloat parseMaybe parseListparseSetparseMapsplitHelpFlag HelpGroupHelpAll HelpSummary addHelpFlags checkHelpFlaghelpForSystem.EnvironmentgetArgs System.Exit exitFailure exitSuccess$fParsedParsedSubcommand$fParsedParsedOptions$fMonadParserM$fMonadOptionsM