Declarative command-line option parsing and documentation library.

Latest on Hackage:0.2.3

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow to host generated Haddocks.

MIT licensed by Eli Frey
Maintained by Eli Frey <eli.lee.frey gmail com>

CmdTheLine aims to remove tedium from the definition of command-line programs, producing usage and help with little effort.

The inspiration was found in Daniel Bunzli's library.

CmdTheLine uses applicative functors to provide a declarative, compositional mechanism for defining command-line programs by lifting regular Haskell functions over argument parsers.

A tutorial can be found at

Suggestions, comments, and bug reports are appreciated. Please see the bug and issue tracker at

Changes since 0.1:

  • More type safety: Types in CmdTheLine.Arg have been made more explicit to disalow unwanted behavior. Positional argument information and optional argument information are distinguished from each other. As well Args must be transformed into Term before use, as some operations make since to perform on Arg but not on Term.

  • ArgVal has only one method: parser and pp have been fused into a tuple, so that instantiation of ArgVal can be simplified for all parties.

  • Err is an instance of MonadIO: The Err monad now supports IO action.

  • File and Directory path validation: Taking advantage of new Err capabilities, the library provides new functions for validating Strings inside of Terms as being valid/existent file/directory paths.

Changes since 0.2.0:

  • Test friendly unwrap functions: To allow the testing of terms, there are now two new functions exported with System.Console.CmdTheLine.Term, unwrap and unwrapChoice. As well a datatype representing cause of early exit, EvalExit is exported.

Changes since 0.2.1

  • Added adapter for interfacing with Getopt in module System.Console.CmdTheLine.