getopt-generics: Create command line interfaces with ease

[ bsd3, console, library, system ] [ Propose Tags ]

Create command line interfaces with ease

[Skip to Readme]
Versions [RSS] [faq] 0.1, 0.1.1, 0.2, 0.3, 0.4, 0.4.1, 0.5, 0.6, 0.6.1, 0.6.2, 0.6.3, 0.7, 0.7.1,, 0.8, 0.9, 0.10,, 0.11,,,, 0.12, 0.13,,,,
Dependencies base (==4.*), base-compat (>=0.8), base-orphans, generics-sop, tagged [details]
License BSD-3-Clause
Copyright Zalora South East Asia Pte Ltd
Author Linh Nguyen, Sönke Hahn
Category Console, System
Home page
Bug tracker
Source repo head: git clone
Uploaded by SoenkeHahn at 2015-09-27T12:08:43Z
Distributions Arch:, Debian:, LTSHaskell:, NixOS:, Stackage:
Downloads 20336 total (88 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2015-09-27 [all 1 reports]




Maintainer's Corner

For package maintainers and hackage trustees


Readme for getopt-generics-0.11

[back to package description]



This library is experimental.


getopt-generics tries to make it very simple to create command line interfaces. Here's an example:

import WithCli

main :: IO ()
main = withCli run

run :: String -> Int -> Bool -> IO ()
run s i b = print (s, i, b)

This is how the program behaves in a shell:

$ program foo 42 true
$ program --help
  -h  --help  show help and exit
$ program foo 42 bar
cannot parse as BOOL: bar
# exit-code 1
$ program
missing argument of type STRING
missing argument of type INTEGER
missing argument of type BOOL
# exit-code 1
$ program foo 42 yes bar
unknown argument: bar
# exit-code 1