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

ModuleCabal-3.12.1.0Haskell2010

Distribution.Simple.Program.Types

This provides an abstraction which deals with configuring and running programs. A Program is a static notion of a known program. A ConfiguredProgram is a Program that has been found on the current machine and is ready to be run (possibly with some user-supplied default args). Configuring a program involves finding its location and if necessary finding its version. There's reasonable default behavior for trying to find "foo" in PATH, being able to override its location, etc.

  • 6 types
  • 3 values
  • PackageCabal-3.12.1.0
  • Exports9
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceTypes.hs

Program and functions for constructing them

3 declarations
datadata Program
#

Represents a program which can be configured.

Note: rather than constructing this directly, start with simpleProgram and override any extra fields.

Constructors

Instances1Show
  • Show ProgramDefined in Cabal-3.12.1.0 · Distribution.Simple.Program.Types

A search path to use when locating executables. This is analogous to the unix $PATH or win32 %PATH% but with the ability to use the system default method for finding executables (findExecutable which on unix is simply looking on the $PATH but on win32 is a bit more complicated).

The default to use is [ProgSearchPathDefault] but you can add extra dirs either before, after or instead of the default, e.g. here we add an extra dir to search after the usual ones.

['ProgramSearchPathDefault', 'ProgramSearchPathDir' dir]

We also use this path to set the environment when running child processes.

The ProgramDb is created with a ProgramSearchPath to which we prependProgramSearchPath to add the ones that come from cli flags and from configurations. Then each of the programs that are configured in the db inherits the same path as part of configureProgram.

Constructors

Instances5Eq, Generic, Binary, Structured, Rep

Configured program and related functions

6 declarations
datadata ConfiguredProgram
#

Represents a program which has been configured and is thus ready to be run.

These are usually made by configuring a Program, but if you have to construct one directly then start with simpleConfiguredProgram and override any extra fields.

Constructors

  • ConfiguredProgram
    • programId :: String

      Just the name again

    • programVersion :: Maybe Version

      The version of this program, if it is known.

    • programDefaultArgs :: [String]

      Default command-line args for this program. These flags will appear first on the command line, so they can be overridden by subsequent flags.

    • programOverrideArgs :: [String]

      Override command-line args for this program. These flags will appear last on the command line, so they override all earlier flags.

    • programOverrideEnv :: [(String, Maybe String)]

      Override environment variables for this program. These env vars will extend/override the prevailing environment of the current to form the environment for the new process.

    • programProperties :: Map String String

      A key-value map listing various properties of the program, useful for feature detection. Populated during the configuration step, key names depend on the specific program.

    • programLocation :: ProgramLocation

      Location of the program. eg. /usr/bin/ghc-6.4

    • programMonitorFiles :: [FilePath]

      In addition to the programLocation where the program was found, these are additional locations that were looked at. The combination of ths found location and these not-found locations can be used to monitor to detect when the re-configuring the program might give a different result (e.g. found in a different location).

Instances7Eq, Read, Show, Generic, Binary, Structured, …
datadata ProgramLocation
#

Where a program was found. Also tells us whether it's specified by user or not. This includes not just the path, but the program as well.

Constructors

Instances7Eq, Read, Show, Generic, Binary, Structured, …