BSD-3-Clause licensed by Chris Dornan
Maintained by chris@chrisdornan.com

Module documentation for 1.0.0.0

This version can be pinned in stack with:optparse-enum-1.0.0.0@sha256:f3d0f604d339ede9aac6e68e9549f9fade81cb9096650fd354575b7b2f3e83e9,1235

optparse-enum

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 =
  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!"

Changes

Changelog for optparse-enum

Unreleased changes

comments powered byDisqus