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.Find

A somewhat extended notion of the normal program search path concept.

Usually when finding executables we just want to look in the usual places using the OS's usual method for doing so. In Haskell the normal OS-specific method is captured by findExecutable. On all common OSs that makes use of a PATH environment variable, (though on Windows it is not just the PATH).

However it is sometimes useful to be able to look in additional locations without having to change the process-global PATH environment variable. So we need an extension of the usual findExecutable that can look in additional locations, either before, after or instead of the normal OS locations.

  • 2 types
  • 7 values
  • PackageCabal-3.12.1.0
  • Exports9
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceFind.hs

Program search path

9 declarations

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

Get the system search path. On Unix systems this is just the $PATH env var, but on windows it's a bit more complicated.

valuesimpleProgram :: String -> Program
#

Make a simple named program.

By default we'll just search for it in the path and not try to find the version name. You can override these behaviours if necessary, eg:

(simpleProgram "foo") { programFindLocation = ... , programFindVersion ... }