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

ndmitchell at gmail.com ndmitchell at gmail.com
Thu Sep 17 13:40:40 UTC 2009


> > 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.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/darcs-users/attachments/20090917/e76a3568/attachment.htm>

More information about the darcs-users mailing list