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-syntax-3.12.1.0Haskell2010

Distribution.Types.ComponentRequestedSpec

  • 2 types
  • 4 values
  • PackageCabal-syntax-3.12.1.0
  • Exports6
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceComponentRequestedSpec.hs

Note: Buildable versus requested versus enabled components

What's the difference between a buildable component (ala componentBuildable), a requested component (ala componentNameRequested), and an enabled component (ala componentEnabled)?

A component is buildable if, after resolving flags and conditionals, there is no buildable: False property in it. This is a static property that arises from the Cabal file and the package description flattening; once we have a PackageDescription buildability is known.

A component is requested if a user specified, via a the flags and arguments passed to configure, that it should be built. E.g., --enable-tests or --enable-benchmarks request all tests and benchmarks, if they are provided. What is requested can be read off directly from ComponentRequestedSpec. A requested component is not always buildable; e.g., a user may --enable-tests but one of the test suites may have buildable: False.

A component is enabled if it is BOTH buildable and requested. Once we have a LocalBuildInfo, whether or not a component is enabled is known.

Generally speaking, most Cabal API code cares if a component is enabled. (For example, if you want to run a preprocessor on each component prior to building them, you want to run this on each enabled component.)

Note that post-configuration, you will generally not see a non-buildable Component. This is because flattenPD will drop any such components from PackageDescription. See #3858 for an example where this causes problems.

Describes what components are enabled by user-interaction. See also this note in Distribution.Types.ComponentRequestedSpec#buildable_vs_enabled_components.

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