Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Failed to load latest commit information.
src/System/Console fix some command line parsing cases
tests add a new test
.gitignore remove .setting folder, fix version display, add withParseResult
.project rename cabal file name
LICENSE add license and improve package meta data bump version and update readme
Setup.hs first commit

Build Status


Declarative & minimalist command line app framework for haskell

This framework is inspired by the argparse package found in python batteries.

This library provides a small combinator dsl to specify a parser for a datatype. Running the parser will automatically consume and convert command line arguments. Default special action such as help/usage are automatically built from the parser specification.

Here is a quick example. First, we need a datatype:

data MyTest = MyTest Int Int
  deriving (Show) -- we will print the values

Then, we define a parser:

myTestParser :: ParserSpec MyTest
myTestParser = MyTest
  `parsedBy` reqPos "pos1"
  `andBy` optPos 0 "pos2"

we can now run a MyTest -> IO () value. It will either perform the action with the parse result, or display an error message:

main = withParseResult myTestParser print

Building this app will produce an executable foo which will behave like this:

$ foo 1 2
MyTest 1 2
$ foo 3
MyTest 3 0
$ foo -h
usage : foo pos1 [pos2] [-h] [--version]

mandatory arguments:

optional arguments:
 -h, --help                    show this help message and exit
 --version                     print the program version and exit

For more information, please visit .

Something went wrong with that request. Please try again.