getOpt return record of type a rather than [a]

Lemmih lemmih at gmail.com
Tue Dec 18 17:54:55 EST 2007


On Dec 18, 2007 11:28 PM, Bulat Ziganshin <bulat.ziganshin at gmail.com> wrote:
> Hello Lemmih,
>
> Wednesday, December 19, 2007, 1:22:43 AM, you wrote:
> > Indeed, we to this in HAppS, for instance. Folding the resulting list
> > makes the current GetOpt implementation more than adequate.
>
> this is problem important for me too - i have >50 options. can you
> please give us a small example of such approach?

Henning posted the specialized structure:
data ArgDescr a =
 NoArg (a -> a)
 ReqArg (String -> a -> a) String
 OptArg (String -> a -> a) String

which is a same as:
type DirectArgDescr a = ArgDescr (a -> a)

The "flags" can be combined using: foldr ($) emptyConfig flags.

-- 
Cheers,
  Lemmih


More information about the Libraries mailing list