HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulecmdargs-0.10.22Haskell2010

System.Console.CmdArgs.GetOpt

This provides a compatiblity wrapper to the System.Console.GetOpt module in base. That module is essentially a Haskell port of the GNU getopt library.

Changes: The changes from GetOpt are listed in the documentation for each function.

  • 3 types
  • 4 values
  • Packagecmdargs-0.10.22
  • Exports7
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceGetOpt.hs
valuegetOpt
  1. :: ArgOrder a
  2. -> [OptDescr a]
  3. -> [String]
  4. -> ([a], [String], [String])
#

Process the command-line, and return the list of values that matched (and those that didn't). The arguments are:

  • The order requirements (see ArgOrder)

  • The option descriptions (see OptDescr)

  • The actual command line arguments (presumably got from getArgs).

getOpt returns a triple consisting of the option arguments, a list of non-options, and a list of error messages.

Changes: The list of errors will contain at most one entry, and if an error is present then the other two lists will be empty.

valueusageInfo :: String -> [OptDescr a] -> String
#

Return a string describing the usage of a command, derived from the header (first argument) and the options described by the second argument.

datadata ArgOrder a
#

What to do with options following non-options.

Changes: Only Permute is allowed, both RequireOrder and ReturnInOrder have been removed.

Instances1Functor
  • Functor ArgOrderDefined in cmdargs-0.10.22 · System.Console.CmdArgs.GetOpt
datadata OptDescr a
#

Each OptDescr describes a single option.

The arguments to Option are:

  • list of short option characters

  • list of long option strings (without "--")

  • argument descriptor

  • explanation of option for user

Constructors

Instances1Functor
datadata ArgDescr a
#

Describes whether an option takes an argument or not, and if so how the argument is injected into a value of type a.

Constructors

Instances1Functor