[email protected]
[Top] [All Lists]

Re: [Haskell-cafe] Typed Configuration Files

Subject: Re: [Haskell-cafe] Typed Configuration Files
From: Ketil Malde
Date: Fri, 15 Jan 2010 09:54:21 +0100
Neil Mitchell <[email protected]> writes:

> The CmdArgs manual might help:
> http://community.haskell.org/~ndm/darcs/cmdargs/cmdargs.htm

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

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

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

'whenMissing'?  'unspecified'?

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

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.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

<Prev in Thread] Current Thread [Next in Thread>