HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulecabal-install-3.12.1.0Haskell2010

Distribution.Client.TargetSelector

Handling for user-specified target selectors.

  • 9 types
  • 8 values

Target selectors

7 declarations
datadata TargetSelector
#

A target selector is expression selecting a set of components (as targets for a actions like build, run, test etc). A target selector corresponds to the user syntax for referring to targets on the command line.

From the users point of view a target can be many things: packages, dirs, component names, files etc. Internally we consider a target to be a specific component (or module/file within a component), and all the users' notions of targets are just different ways of referring to these component targets.

So target selectors are expressions in the sense that they are interpreted to refer to one or more components. For example a TargetPackage gets interpreted differently by different commands to refer to all or a subset of components within the package.

The syntax has lots of optional parts:

[ package name | package dir | package .cabal file ]
[ [lib:|exe:] component name ]
[ module name | source file ]

Constructors

Instances5Eq, Ord, Show, Generic, Rep
datadata TargetImplicitCwd
#

Does this TargetPackage selector arise from syntax referring to a package in the current directory (e.g. tests or no giving no explicit target at all) or does it come from syntax referring to a package name or location.

Instances5Eq, Ord, Show, Generic, Rep
datadata SubComponentTarget
#

Either the component as a whole or detail about a file or module target within a component.

Constructors

Instances7Eq, Ord, Show, Generic, Binary, Structured, …
datadata QualLevel
#

Qualification levels. Given the filepath src/F, executable component A, and package foo:

Constructors

  • QL1
    src/F
  • QL2
    foo:srcF | A:srcF
  • QL3
    foo:A:srcF | exe:A:srcF
  • QLFull
    pkg:foo:exe:A:file:src/F
Instances3Enum, Eq, Show
  • Enum QualLevelDefined in cabal-install-3.12.1.0 · Distribution.Client.TargetSelector
  • Eq QualLevelDefined in cabal-install-3.12.1.0 · Distribution.Client.TargetSelector
  • Show QualLevelDefined in cabal-install-3.12.1.0 · Distribution.Client.TargetSelector

Reading target selectors

7 declarations
valuereadTargetSelectors
  1. :: [PackageSpecifier (SourcePackage (PackageLocation a))]
  2. -> Maybe ComponentKindFilter

    This parameter is used when there are ambiguous selectors. If it is Just, then we attempt to resolve ambiguity by applying it, since otherwise there is no way to allow contextually valid yet syntactically ambiguous selectors. (#4676, #5461)

  3. -> [String]
  4. -> IO (Either [TargetSelectorProblem] [TargetSelector])
#

Parse a bunch of command line args as TargetSelectors, failing with an error if any are unrecognised. The possible target selectors are based on the available packages (and their locations).

The various ways that trying to resolve a TargetString to a TargetSelector can fail.

Instances2Eq, Show
datadata TargetString
#

The outline parse of a target selector. It takes one of the forms:

str1
str1:str2
str1:str2:str3
str1:str2:str3:str4
Instances2Eq, Show
  • Eq TargetStringDefined in cabal-install-3.12.1.0 · Distribution.Client.TargetSelector
  • Show TargetStringDefined in cabal-install-3.12.1.0 · Distribution.Client.TargetSelector

non-IO