bmjames / scala-optparse-applicative

Scala port of Paolo Capriotti's optparse-applicative library. This repository is no longer maintained; newer versions exist in this fork: https://github.com/xuwei-k/optparse-applicative
BSD 3-Clause "New" or "Revised" License
72 stars 9 forks source link

Add example on how to use `helper` when validating arguments #11

Open dnadales opened 8 years ago

dnadales commented 8 years ago

Consider the following setting:

  type V[A] = ValidationNel[String, A]
  type ParserV[A] = Parser[V[A]]

implicit val ParserVInstance: Applicative[ParserV] =
       Applicative[Parser] compose Applicative[V]

 val optsParser: ParserV[Options] = ???

In this case it is not possible to compose the parsers with helper:

 execParser(args, "xxx", info(optsParser <*> helper))

It'd be nice to have an example on how helper can be used in the setting of parsers with validation.