Skip to content
Helpers for optparse-applicative to deal with Data.Text
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/Options/Applicative
test
.gitignore
.travis.yml
LICENSE
README.md
Setup.hs
package.yaml
stack.yaml

README.md

optparse-text

Build Status Hackage Stackage LTS Stackage Nightly

Helpers for optparse-applicative to deal with Data.Text.

Example

import qualified Data.Text                 as T
import qualified Options.Applicative       as Opt
import qualified Options.Applicative.Text  as OptT

data Options = Options { text    :: T.Text
                       , textArg :: T.Text
                       , textOpt :: T.Text }
  deriving (Eq, Show)

optParser :: Opt.Parser Options
optParser = Options <$> Opt.argument OptT.text ( Opt.metavar "TEXT" )
                    <*> OptT.textArgument ( Opt.metavar "TEXT2" )
                    <*> OptT.textOption ( Opt.long "textopt" )

Alternatives

You may want to consider using optparse-generic which has built-in support for Text and provides a very convient generic interface to optparse avoiding a lot of boilerplate.

You can’t perform that action at this time.