Re: [Haskell-cafe] Parsing arguments and reading configuration

2008-09-21 Thread Magnus Therning
On Sun, Sep 21, 2008 at 4:02 PM, Sterling Clover <[EMAIL PROTECTED]> wrote: > Alternately, just go with a map initially with default values. Then parse > the command line args into a second map (especially if they're all of a > format like -argname argvalue). Then lookup your args file with the com

Re: [Haskell-cafe] Parsing arguments and reading configuration

2008-09-21 Thread Sterling Clover
Alternately, just go with a map initially with default values. Then parse the command line args into a second map (especially if they're all of a format like -argname argvalue). Then lookup your args file with the command line map, and failing that the default map. Then read the args file a

Re: [Haskell-cafe] Parsing arguments and reading configuration

2008-09-19 Thread Antoine Latter
On Fri, Sep 19, 2008 at 7:35 PM, Antoine Latter <[EMAIL PROTECTED]> wrote: > I'm not sure how well it would hold up under maintenance, but you coud > have a config sum-type which is itself a monoid, and then create two > of them: > And by sum-type I mean product type. Sheesh. Although having you

Re: [Haskell-cafe] Parsing arguments and reading configuration

2008-09-19 Thread Antoine Latter
2008/9/19 Magnus Therning <[EMAIL PROTECTED]>: > > First I thought I'd treat the configuration in a similar way, but then I > noticed a slight ordering problem. The command line arguments should > take priority over the contents of the configuration file, but the > location of the configuration ca

Re: [Haskell-cafe] Parsing arguments and reading configuration

2008-09-19 Thread Derek Elkins
On Fri, 2008-09-19 at 23:24 +0100, Magnus Therning wrote: > Hi all, > > I'm looking for some inspiration for an elegant solution to a silly > little problem I have. This might have a general well-known solution, > or maybe there's something particularly elegant possible in Haskell. I > just thou

[Haskell-cafe] Parsing arguments and reading configuration

2008-09-19 Thread Magnus Therning
Hi all, I'm looking for some inspiration for an elegant solution to a silly little problem I have. This might have a general well-known solution, or maybe there's something particularly elegant possible in Haskell. I just thought I'd ask. When writing a command line tool I want to use a configu