On Thu, Jul 26, 2007 at 10:25:06PM -0700, Dave Bayer wrote:
Ok, I'm writing a command line tool, using System.Console.GetOpt to handle
command line arguments. My Flags structure so far is
data Flag
= Filter String
| DateFormat String
| DocStart String
| DocEnd
Hi
Why not:
data Flag
= Filter String
| DateFormat String
| DocStart String
| DocEnd String
Becomes:
data Flag = Flag Key String
data Key = Filter | DateFormat | DocStart | DocEnd
getString :: Flag - Key - String
getString (Flag x y) key = if key == x then y else
You can easily
On Friday 27 July 2007, Dave Bayer wrote:
Ok, I'm writing a command line tool, using System.Console.GetOpt to
handle command line arguments. My Flags structure so far is
data Flag
= Filter String
| DateFormat String
| DocStart String
| DocEnd String
...
and I
Ok, I'm writing a command line tool, using System.Console.GetOpt to
handle command line arguments. My Flags structure so far is
data Flag
= Filter String
| DateFormat String
| DocStart String
| DocEnd String
...
and I want to write accessor functions that return the strings
Hi,
Not sure if this will help avoid the boilerplate, but I've always liked
the approach at
http://leiffrenzel.de/papers/commandline-options-in-haskell.html
(particularly the section Towards a higher level) for being able to
specify defaults. It's the best resource I've found on command line