HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

ModuleAgda-2.8.0.2Haskell2010

Agda.Utils.GetOpt

This module provides facilities for parsing the command-line options in a standalone program. It is essentially a Haskell port of the GNU getopt library.

It is a fork of System.Console.GetOpt from the base package of GHC, written by Sven Panne.

We modify it to remove the "allow prefixes of long options" behavior.

Contents
  1. GetOpt
Synopsis
  • PackageAgda-2.8.0.2
  • Exports6
  • LanguageHaskell2010
  • LicenceMIT
  • SourceGetOpt.hs

GetOpt

valuegetOpt
  1. :: ArgOrder a

    non-option handling

  2. -> [OptDescr a]

    option descriptors

  3. -> [String]

    the command-line arguments

  4. -> ([a], [String], [String])
    (options, non-options, error messages)

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.

valuegetOpt'
  1. :: ArgOrder a

    non-option handling

  2. -> [OptDescr a]

    option descriptors

  3. -> [String]

    the command-line arguments

  4. -> ([a], [String], [String], [String])
    (options, non-options, unrecognized, error messages)

This is almost the same as getOpt, but returns a quadruple consisting of the option arguments, a list of non-options, a list of unrecognized options, and a list of error messages.

valueusageInfo
  1. :: String

    header

  2. -> [OptDescr a]

    option descriptors

  3. -> String

    nicely formatted description of options

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

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