[Haskell-cafe] optparse-applicative with attoparsec parser

Henning Thielemann lemming at henning-thielemann.de
Fri Feb 4 16:34:30 UTC 2022


On Fri, 4 Feb 2022, PICCA Frederic-Emmanuel wrote:

> I Try to write a parser for this command line
>
> binoculars-ng --debug process data/test/config_sixs_ruche_flymedv_3.ini 698-734 735-736
>
> But I  have this problem
>
> Invalid argument `735-736'
>
> The parser used for this is this one
>
> processOptions :: Parser Options
> processOptions = Process
>                 <$> optional config
>                 <*> optional (argument (eitherReader (parseOnly configRangeP . pack)) (metavar "RANGE"))
>
> it use the configRangeP attoparser parser whcih knows how to deal with the string "698-734 735-736"

I guess you must use something like (many (argument ...)).


More information about the Haskell-Cafe mailing list