[darcs-users] [issue1550] general purpose command line parsing library (CmdArgs)

Neil Mitchell ndmitchell at gmail.com
Thu Sep 17 21:11:40 UTC 2009


I've started writing cmdargs for darcs, using the features that I
intend to add to cmdargs v0.2 - i.e. it won't work, but I expect it
will work pretty much as written. My version is at:

I think it's pretty compact, and looks quite nice. It handles all the
features you need, and is fairly declarative. If anyone wants to take
a quite look and let me know how it looks to darcs programmers that
would be great. Otherwise, in about a months time, I'll implement the
features in cmdargs and pass over a fully-formed darcs command line

Thanks, Neil

On Thu, Sep 17, 2009 at 2:40 PM,  <ndmitchell at gmail.com> wrote:
> Hi
>> > Why not: compress :: Bool? That's what I've done now, for things like
>> > compression if you introduce gzip/bzip/lzma etc we can expand to a
>> > flag, but for most things bool captures the options.
>> Because then you end up with lots of unspecific Bool bits in signatures
>> (instead of Compression -- which states what is the purpose of the
>> parameter
>> clearly), and pattern matches look like foo True and foo False instead of
>> foo
>> GzipCompression and foo NoCompression. It's just a readability thing.
> I should have stated my idea more clearly:
> data Opts = Opts {compress :: Bool}
> now you can pattern match on {compress=True}, and the name is always
> associated with the type perfectly. Of course, some people prefer explicit
> enumerations so that's perfectly possible too.
> Thanks
> Neil

More information about the darcs-users mailing list