On Mon, Feb 14, 2011 at 19:11, Neil Mitchell ndmitch...@gmail.com wrote:
Hi Magnus,
Finally, you can switch to the pure annotations. I will document them
shortly and give an example in System.Console.CmdArgs.Implicit, but
for now the details can be found at
{-# OPTIONS_GHC -fno-warn-missing-fields #-}
That's what I did in my CmdArgs test suite - if you have all your
CmdArgs bit in a separate file then missing this warning will be fine.
I don't know of any way to rewrite the code to indicate to GHC that
you know what you are doing.
Thanks, Neil
On
Hi Magnus,
Finally, you can switch to the pure annotations. I will document them
shortly and give an example in System.Console.CmdArgs.Implicit, but
for now the details can be found at
http://hackage.haskell.org/packages/archive/cmdargs/0.6.7/doc/html/System-Console-CmdArgs-Annotate.html
I'm looking for a good way of dealing with common flags in cmdargs.
Currently what I do requires a bit of repetition that I'd really like
to get rid of:
1. Data types
data Modes = Cmd1 { foo :: String, ... } | Cmd2 { foo :: String, ... }
2. Mode specifications
cmd1 = Cmd1 { foo = def =
Magnus,
I used the following technique, but it was a couple of iterations of CmdArgs
ago:
data UIMode = Normal | Batch | Query deriving (Data,Typeable,Show,Eq)
uimode_arg :: forall t. t - UIMode
uimode_arg _ = enum Normal
[ Batch = flag B text batch mode (no interaction)
Hi Magnus,
What you want is actually easier than you think!
To quote from
http://hackage.haskell.org/packages/archive/cmdargs/0.6.7/doc/html/System-Console-CmdArgs-Implicit.html:
Missing Fields: If a field is shared by multiple modes, it may be
omitted in subsequent modes, and will default to