This PR provides the ability to use Maybe a types in the datatype target of parsing. This is particularly useful for optional arguments that don't have a natural "default".
Imagine an --limit flag argument where the application operates "unbounded" if no limit is provided. You could use -1 as a default (or some other magic number) to fake this behavior, but using Maybe Int is much cleaner.
Currently this functionality requires creating a custom Argument with a custom parser. This seems like a reasonably common case for a command line application so I'd like to add first class support for it.
This PR provides the ability to use
Maybe a
types in the datatype target of parsing. This is particularly useful for optional arguments that don't have a natural "default".Imagine an
--limit
flag argument where the application operates "unbounded" if no limit is provided. You could use-1
as a default (or some other magic number) to fake this behavior, but usingMaybe Int
is much cleaner.Currently this functionality requires creating a custom Argument with a custom parser. This seems like a reasonably common case for a command line application so I'd like to add first class support for it.