optparse-enum: An enum-text based toolkit for optparse-applicative

[ bsd3, cli, library, options, parsing, system ] [ Propose Tags ]


[Index] [Quick Jump]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Versions [RSS]
Change log ChangeLog.md
Dependencies base (>=4.8 && <10), enum-text (>=, fmt (>=0.6), optparse-applicative (>=0.12), text (>= [details]
License BSD-3-Clause
Copyright 2019 Chris Dornan
Author Chris Dornan
Maintainer chris@chrisdornan.com
Category System, CLI, Options, Parsing
Home page https://github.com/cdornan/optparse-enum#readme
Bug tracker https://github.com/cdornan/optparse-enum/issues
Source repo head: git clone https://github.com/cdornan/optparse-enum
Uploaded by ChrisDornan at 2019-07-21T17:14:58Z
Distributions LTSHaskell:, Stackage:
Downloads 685 total (11 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2019-07-21 [all 1 reports]

Readme for optparse-enum-

[back to package description]


An enum-text based toolkit for optparse-applicative.

A simple but complete example:

{-# LANGUAGE DeriveAnyClass    #-}
{-# LANGUAGE DerivingVia       #-}
{-# LANGUAGE OverloadedStrings #-}

import Fmt
import Text.Enum.Optparse
import Paths_optparse_enum

data Choice
  = C_version
  | C_hello
  deriving (Bounded,Enum,EnumText,Eq,Ord,Show)
  deriving (Buildable,TextParsable) via UsingEnumText Choice

parserDetails ::   ParserDetails
parserDetails =
    { _pd_desc   = "optparse-enum example program"
    , _pd_header = "A simple optparse-enum illustrative program"
    , _pd_footer = "See the optparse-enum page on Hackage for details"

main :: IO ()
main = do
  choice <- parseIO parserDetails enumSwitchesP
  case choice of
    C_version -> print    version
    C_hello   -> putStrLn "Hello!"