[Haskell-cafe] Typed Configuration Files
ketil at malde.org
Fri Jan 15 03:54:21 EST 2010
Neil Mitchell <ndmitchell at gmail.com> writes:
> The CmdArgs manual might help:
Yes, this is what I used :-) Presenting examples is great, but gives me
the hubris to rip off the example that seems to fit most closely, and
modify it. This makes for a quick start, but also for the odd
> I'd describe cmdargs as referentially impure, but really concise.
Concise is nice - I've often been a bit annoyed that the otherwise nice
GetOpt stuff forces me to write a lot of boilerplate, enough of it that
my programs usually have a separate Options module. For a lazy slob
like me, this means I often just hack something on top of the raw
GetArgs or write half-baked but simple solutions like my simpleargs
> 'def' is the default value, empty has a particular semantic meaning
> and serves to change the options. I should document this more
> carefully. Perhaps empty should be renamed 'optional', since that's
> what it does.
>> - As I wanted a single file argument, I tried to use 'args' in
>> combination with a parameter of type FilePath. Apparently 'args'
>> wants [FilePath] and appends command line arguments to the default
Spoilt by Haskell, I'd have expected a type error here.
> argPos 0 should do the trick.
Right. Will subsequent arguments be ignored?
> CmdArgs is very much a 0.1 release. The documentation isn't polished,
> it does simple arguments nicely, but has flaws when you try and go
> more advanced. I want to spend some more time on it at some point.
That's great, I'm looking forward to it.
If I haven't seen further, it is by standing in the footprints of giants
More information about the Haskell-Cafe