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

Distribution.Simple.Compiler

This should be a much more sophisticated abstraction than it is. Currently it's just a bit of data about the compiler, like its flavour and name and version. The reason it's just data is because currently it has to be in Read and Show so it can be saved along with the LocalBuildInfo. The only interesting bit of info it contains is a mapping between language extensions and compiler command line flags. This module also defines a PackageDB type which is used to refer to package databases. Most compilers only know about a single global package collection but GHC has a global and per-user one and it lets you create arbitrary other package databases. We do not yet fully support this latter feature.

  • 12 types
  • 41 values
  • PackageCabal-3.12.1.0
  • Exports53
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceCompiler.hs

Haskell implementations

21 declarations
datadata CompilerId
#
Instances11Eq, Ord, Read, Show, Generic, NFData, …
datadata AbiTag
#
Instances9Eq, Read, Show, Generic, Binary, Parsec, …
datadata CompilerFlavor
#
Instances13Eq, Data, Ord, Read, Show, Generic, …
datadata CompilerInfo
#

Compiler information used for resolving configurations. Some fields can be set to Nothing to indicate that the information is unknown.

Constructors

Instances5Read, Show, Generic, Binary, Rep
datadata PerCompilerFlavor v
#

PerCompilerFlavor carries only info per GHC and GHCJS

Cabal parses only ghc-options and ghcjs-options, others are omitted.

Constructors

Instances15Functor, Foldable, Traversable, Eq, Data, Ord, …

The default compiler flavour to pick when compiling stuff. This defaults to the compiler used to build the Cabal lib.

However if it's not a recognised compiler then it's Nothing and the user will have to specify which compiler they want.

datadata Compiler
#

Constructors

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

Is this compiler compatible with the compiler flavour we're interested in?

For example this checks if the compiler is actually GHC or is another compiler that claims to be compatible with some version of GHC, e.g. GHCJS.

if compilerCompatFlavor GHC compiler then ... else ...

Is this compiler compatible with the compiler flavour we're interested in, and if so what version does it claim to be compatible with.

For example this checks if the compiler is actually GHC-7.x or is another compiler that claims to be compatible with some GHC-7.x version.

case compilerCompatVersion GHC compiler of
  Just (Version (7:_)) -> ...
  _                    -> ...

Support for package databases

5 declarations
datadata PackageDB
#

Some compilers have a notion of a database of available packages. For some there is just one global db of packages, other compilers support a per-user or an arbitrary db specified at some location in the file system. This can be used to build isolated environments of packages, for example to build a collection of related packages without installing them globally.

Instances8Eq, Ord, Read, Show, Generic, Binary, …
typetype PackageDBStack = [PackageDB]
#

We typically get packages from several databases, and stack them together. This type lets us be explicit about that stacking. For example typical stacks include:

[GlobalPackageDB]
[GlobalPackageDB, UserPackageDB]
[GlobalPackageDB, SpecificPackageDB "package.conf.inplace"]

Note that the GlobalPackageDB is invariably at the bottom since it contains the rts, base and other special compiler-specific packages.

We are not restricted to using just the above combinations. In particular we can use several custom package dbs and the user package db together.

When it comes to writing, the top most (last) package is used.

Support for optimisation levels

2 declarations
datadata OptimisationLevel
#

Some compilers support optimising. Some have different levels. For compilers that do not the level is just capped to the level they do support.

Instances9Bounded, Enum, Eq, Read, Show, Generic, …

Support for debug info levels

2 declarations
datadata DebugInfoLevel
#

Some compilers support emitting debug info. Some have different levels. For compilers that do not the level is just capped to the level they do support.

Instances9Bounded, Enum, Eq, Read, Show, Generic, …

Support for language extensions

19 declarations

Does this compiler's "ar" command support llvm-ar's -L flag, which compels the archiver to add an input archive's members rather than adding the archive itself.

Support for profiling detail levels

4 declarations
datadata ProfDetailLevel
#

Some compilers (notably GHC) support profiling and can instrument programs so the system can account costs to different functions. There are different levels of detail that can be used for this accounting. For compilers that do not support this notion or the particular detail levels, this is either ignored or just capped to some similar level they do support.

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