b^j)      !"#$%&'(None &357;>LNQA collection of the errors that can be encountered upon trying to get and run a  If a parameter's  instance returns Just [] , complain:bMore input values are provided than the function requires. Provides the list of remaining values.FNot enough input values are provided to the function, so it can't run.We didn't find any function with the given path. Provides the possible path pieces that could have been supplied to go one level deeper.We didn't find a path corresponding to some string. Returns the possible paths that could have been taken from that location, and the failing string.We tried converting the flag (provided as the first param) to the type asked for, and failed for some reason (provided as the second param).VWe tried converting some value to the type asked and failed with the reason provided.FYou probably won't ever need to interact with this type; it is just a State monad on our  Q type in order that we can use monadic notation to build up our nested structure. )This is the type returned from using the # function along with helpers like  and  a to build up a nested structure of commands. We can manually traverse it by looking through the  2 Map to acess nested commands, or inspecting the   and  w properties of the current command. This makes it easy to do things like autocomplete commands, or print out help etc.Our existential f type is used for hiding away the details of some provided function. Any function that satisfies the / tuple of type classes can be wrapped in this.9A type containing information about a function parameter.@Return a piece of help text describing what the parameter means.8Should the parameter match against flags? If so, return  Just [flags]< from this. If the param should be a value instead, return Nothing.Describe how to turn the String9 parameter given into our custom type. The input may be Nothing5 if the flag/value is not provided, else it will be Just str where str is the input string.A tuple of typeclasses that must all be implemented for function parameter types in order that they can be used in the functions attached to commands. $ is the only mandatory requirement ( and I have default defitions), however it is recommended that you implement & in all cases, and you must implement i if you want your new type to match against provided flags. An example custom parameter implementation: 1data Verbose = Verbose Bool instance ParamFlags Verbose where paramFlags _ = Just ["v", "verbose"] instance ParamHelp Verbose where paramHelp _ = "Make the command more verbose" instance ToParam Verbose where toParam (Just _) = Right (Verbose True) toParam Nothing = Right (Verbose False)Here, we define a Verbose type that will equal  Verbose True: if the "v" or "verbose" flag is used in the command, or  Verbose False otherwise./To extract the value, all we have to do is use  (Verbose b)& in our commands function now, where b will be either True or False.See % for the definitions of the provided Value and Flag parameter types. given our Fn out1 type, containing some function that will return out on successful execution, attempt to run the function by injecting a list of values and a map of flags to it. This will either return a @ denoting what failed, or the output from running the function.Run against our Fn out. wrapped function, this will return a list of 7 details for each parameter in the contained function.Given a 2 type as its only argument, this resolves it to a   object, ready to make use of. This is basically the entry point to defining our commands, inside which we can use the functions below to populate our structure.9Nest a command with some name inside the current command.#Attach help to the current command. zAttach a function which will be tried if the current command is matched. The parameters to the function must satisfy the F typeclasses, which will automatically make the function satisfy the ExtractParameters and InjectParameters typeclasses.!#Attempt to run a function inside a   object, using the first argument (a list of strings) to first navigate to the relevant subcommand and then have any remainder used as values to be passed to the command, and the second argument as a map of flags to be passed to the command.""Attempt to get hold of the nested  ) at the path provided inside a provided   object.2 )*+,-. !"/01234567#  !"#  !"  )*+,-. !"/01234567None (35>KLN#Typeclass used by ' and %V to convert the provided string to the desired haskell type. Anything that satisfies Read- will satisfy this, but we can override the ReadN behaviour as we see fit on a per type basis by explicitly implementing this.%*Use this type in a function embedded in a Command in order to require a value. The type signature for this contains the associated help text for the command, and the type we expect the value to be cast to.'*Use this type in a function embedded in a Command in order to require a flag. The type signature for this lists the flags that we want to match against, the associated help text, and the output type we want the flag to be cast to.Flags of Maybe or Boolk types have special handling: if the flag doesnt exist for either of these types, we'll be handed back a False/NothingI rather than get an error, else if the flag does exist we'll get back a True/Just val. Bool~ flags are expected to be provided an empty string as the value; if you care about the value but want it to be optional, use Maybe.89#$%&'(:;<=>?@ABCDE#$%&'('(%&#$89#$%&'(:;<=>?@ABCDENone)  !"#$%&'(F      !"#$%&''(()*+,-./0123456789:;<=>?@ABCDEFcomma_96iNnpefOeL7dmDTrCvi2NCommander.CommandsCommander.Params CommanderParams CommandErrorErrParamHasNoFlagsErrTooManyValuesErrNotEnoughValuesErrNotEnoughPathErrPathNotFoundErrCastingFlagErrCastingValueCommandsCommand cmdChildrencmdHelpcmdFuncFn ParameterparameterFlags parameterHelp ParamHelp paramHelp ParamFlags paramFlagsToParamtoParam IsParameter injectParams extractParamscommandscommandhelprun evalCommand getCommand FromString fromStringValueFlagExtractParametersextractParametersInjectParametersinjectParametersFnOut emptyCommandstepIntoCommandtoEithermapLeft catchEither$fShowFn$fExtractParametersoutout$fExtractParameters(->)out$fInjectParametersoutout$fInjectParameters(->)out KnownSymbols symbolVals$fKnownSymbols[]$fKnownSymbols: $fFromStringa$fFromString[]$fParamHelpValue$fParamFlagsValue$fToParamValue$fParamHelpFlag$fParamFlagsFlag $fToParamFlag$fToParamFlag0$fToParamFlag1