[Haskell-cafe] GetOpt
Brian Hulley
brianh at metamilk.com
Thu Apr 27 17:05:45 EDT 2006
Brian Hulley wrote:
> moduleOptions = ComposedOption "My module" [ModOption1, ModOption2]
moduleOptions = Option $ ComposedOption "My module" [ModOption1, ModOption2]
> allOptions = ComposedOption "Name of program" [Module1.moduleOptions,
allOptions = Option $ ComposedOption "Name of program"
[Module1.moduleOptions,
Thinking more about it, it would be better to change the type of
ComposedOption to:
data ComposedOption = ComposedOption [(String, Option)]
since an option by itself can't tell what it's name should be because any
name specified might conflict with other option names, but the parent can
assign different names safely.
Also, many different schemes for composing options could be devised, so that
some subsets of options would be indexed by a number instead of a letter
etc.
Regards, Brian.
PS: this is definitely a good case for the use of augmented IO since the
fact that a particular module needs to store option state should be
completely invisible to the rest of the program...
More information about the Haskell-Cafe
mailing list