ModuleCabal-3.16.0.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.
- 18 types
- 51 values
- PackageCabal-3.16.0.0
- Exports69
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceCompiler.hs
Haskell implementations
21 declarationsThe 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.
Make a CompilerInfo of which only the known information is its CompilerId, its AbiTag and that it does not claim to be compatible with other compiler id's.
Instances9Eq, Read, Show, Generic, Binary, Parsec, …
Eq AbiTagDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerRead AbiTagDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerShow AbiTagDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerGeneric AbiTagDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerBinary AbiTagDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerParsec AbiTagDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerPretty AbiTagDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerStructured AbiTagDefined in Cabal-syntax-3.16.0.0 · Distribution.Compilertype Rep AbiTag = D1 ('MetaDataDefined in Cabal-syntax-3.16.0.0 · Distribution.Compiler"AbiTag"
"Distribution.Compiler"
"Cabal-syntax-3.16.0.0-c954"
'False) (C1 ('MetaCons"NoAbiTag"
'PrefixI 'False) U1 :+: C1 ('MetaCons"AbiTag"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))
Instances13Eq, Data, Ord, Read, Show, Generic, …
Eq CompilerFlavorDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerData CompilerFlavorDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerOrd CompilerFlavorDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerRead CompilerFlavorDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerShow CompilerFlavorDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerGeneric CompilerFlavorDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerNFData CompilerFlavorDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerBinary CompilerFlavorDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerParsec CompilerFlavorDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerPretty CompilerFlavorDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerStructured CompilerFlavorDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerNewtype (CompilerFlavor, VersionRange) TestedWithDefined in Cabal-syntax-3.16.0.0 · Distribution.FieldGrammar.Newtypestype Rep CompilerFlavor = D1 ('MetaDataDefined in Cabal-syntax-3.16.0.0 · Distribution.Compiler"CompilerFlavor"
"Distribution.Compiler"
"Cabal-syntax-3.16.0.0-c954"
'False) (((C1 ('MetaCons"GHC"
'PrefixI 'False) U1 :+: (C1 ('MetaCons"GHCJS"
'PrefixI 'False) U1 :+: C1 ('MetaCons"NHC"
'PrefixI 'False) U1)) :+: (C1 ('MetaCons"YHC"
'PrefixI 'False) U1 :+: (C1 ('MetaCons"Hugs"
'PrefixI 'False) U1 :+: C1 ('MetaCons"HBC"
'PrefixI 'False) U1))) :+: ((C1 ('MetaCons"Helium"
'PrefixI 'False) U1 :+: (C1 ('MetaCons"JHC"
'PrefixI 'False) U1 :+: C1 ('MetaCons"LHC"
'PrefixI 'False) U1)) :+: ((C1 ('MetaCons"UHC"
'PrefixI 'False) U1 :+: C1 ('MetaCons"Eta"
'PrefixI 'False) U1) :+: (C1 ('MetaCons"MHS"
'PrefixI 'False) U1 :+: C1 ('MetaCons"OtherCompiler"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))))))
Constructors
Instances11Eq, Ord, Read, Show, Generic, NFData, …
Eq CompilerIdDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerOrd CompilerIdDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerRead CompilerIdDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerShow CompilerIdDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerGeneric CompilerIdDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerNFData CompilerIdDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerBinary CompilerIdDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerParsec CompilerIdDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerPretty CompilerIdDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerStructured CompilerIdDefined in Cabal-syntax-3.16.0.0 · Distribution.Compilertype Rep CompilerId = D1 ('MetaDataDefined in Cabal-syntax-3.16.0.0 · Distribution.Compiler"CompilerId"
"Distribution.Compiler"
"Cabal-syntax-3.16.0.0-c954"
'False) (C1 ('MetaCons"CompilerId"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CompilerFlavor) :*: S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Version)))
Compiler information used for resolving configurations. Some fields can be set to Nothing to indicate that the information is unknown.
Constructors
CompilerInfocompilerInfoId :: CompilerIdCompiler flavour and version.
compilerInfoAbiTag :: AbiTagTag for distinguishing incompatible ABI's on the same architecture/os.
compilerInfoCompat :: Maybe [CompilerId]Other implementations that this compiler claims to be compatible with, if known.
compilerInfoLanguages :: Maybe [Language]Supported language standards, if known.
compilerInfoExtensions :: Maybe [Extension]Supported extensions, if known.
Instances5Read, Show, Generic, Binary, Rep
Read CompilerInfoDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerShow CompilerInfoDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerGeneric CompilerInfoDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerBinary CompilerInfoDefined in Cabal-syntax-3.16.0.0 · Distribution.Compilertype Rep CompilerInfo = D1 ('MetaDataDefined in Cabal-syntax-3.16.0.0 · Distribution.Compiler"CompilerInfo"
"Distribution.Compiler"
"Cabal-syntax-3.16.0.0-c954"
'False) (C1 ('MetaCons"CompilerInfo"
'PrefixI 'True) ((S1 ('MetaSel ('Just"compilerInfoId"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CompilerId) :*: S1 ('MetaSel ('Just"compilerInfoAbiTag"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AbiTag)) :*: (S1 ('MetaSel ('Just"compilerInfoCompat"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe [CompilerId])) :*: (S1 ('MetaSel ('Just"compilerInfoLanguages"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe [Language])) :*: S1 ('MetaSel ('Just"compilerInfoExtensions"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe [Extension]))))))
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, …
Functor PerCompilerFlavorDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerFoldable PerCompilerFlavorDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerTraversable PerCompilerFlavorDefined in Cabal-syntax-3.16.0.0 · Distribution.CompilerEq v => Eq (PerCompilerFlavor v)Defined in Cabal-syntax-3.16.0.0 · Distribution.CompilerData v => Data (PerCompilerFlavor v)Defined in Cabal-syntax-3.16.0.0 · Distribution.CompilerOrd v => Ord (PerCompilerFlavor v)Defined in Cabal-syntax-3.16.0.0 · Distribution.CompilerRead v => Read (PerCompilerFlavor v)Defined in Cabal-syntax-3.16.0.0 · Distribution.CompilerShow v => Show (PerCompilerFlavor v)Defined in Cabal-syntax-3.16.0.0 · Distribution.CompilerGeneric (PerCompilerFlavor v)Defined in Cabal-syntax-3.16.0.0 · Distribution.CompilerSemigroup a => Semigroup (PerCompilerFlavor a)Defined in Cabal-syntax-3.16.0.0 · Distribution.Compiler(Semigroup a, Monoid a) => Monoid (PerCompilerFlavor a)Defined in Cabal-syntax-3.16.0.0 · Distribution.CompilerNFData a => NFData (PerCompilerFlavor a)Defined in Cabal-syntax-3.16.0.0 · Distribution.CompilerBinary a => Binary (PerCompilerFlavor a)Defined in Cabal-syntax-3.16.0.0 · Distribution.CompilerStructured a => Structured (PerCompilerFlavor a)Defined in Cabal-syntax-3.16.0.0 · Distribution.Compilertype Rep (PerCompilerFlavor v) = D1 ('MetaDataDefined in Cabal-syntax-3.16.0.0 · Distribution.Compiler"PerCompilerFlavor"
"Distribution.Compiler"
"Cabal-syntax-3.16.0.0-c954"
'False) (C1 ('MetaCons"PerCompilerFlavor"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 v) :*: S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 v)))
Constructors
CompilercompilerId :: CompilerIdCompiler flavour and version.
compilerAbiTag :: AbiTagTag for distinguishing incompatible ABI's on the same architecture/os.
compilerCompat :: [CompilerId]Other implementations that this compiler claims to be compatible with.
compilerLanguages :: [(Language, CompilerFlag)]Supported language standards.
compilerExtensions :: [(Extension, Maybe CompilerFlag)]Supported extensions.
compilerProperties :: Map String StringA key-value map for properties not covered by the above fields.
Instances7Eq, Read, Show, Generic, Binary, Structured, …
Eq CompilerDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerRead CompilerDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerShow CompilerDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerGeneric CompilerDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerBinary CompilerDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerStructured CompilerDefined in Cabal-3.16.0.0 · Distribution.Simple.Compilertype Rep Compiler = D1 ('MetaDataDefined in Cabal-3.16.0.0 · Distribution.Simple.Compiler"Compiler"
"Distribution.Simple.Compiler"
"Cabal-3.16.0.0-2669"
'False) (C1 ('MetaCons"Compiler"
'PrefixI 'True) ((S1 ('MetaSel ('Just"compilerId"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CompilerId) :*: (S1 ('MetaSel ('Just"compilerAbiTag"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AbiTag) :*: S1 ('MetaSel ('Just"compilerCompat"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [CompilerId]))) :*: (S1 ('MetaSel ('Just"compilerLanguages"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(Language, CompilerFlag)]) :*: (S1 ('MetaSel ('Just"compilerExtensions"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(Extension, Maybe CompilerFlag)]) :*: S1 ('MetaSel ('Just"compilerProperties"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map String String))))))
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
15 declarationsSome 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.
Abstracted over
Constructors
GlobalPackageDBUserPackageDBSpecificPackageDB fpNB: the path might be relative or it might be absolute
Instances11Functor, Foldable, Traversable, Eq, Ord, Read, …
Functor PackageDBXDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerFoldable PackageDBXDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerTraversable PackageDBXDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerEq fp => Eq (PackageDBX fp)Defined in Cabal-3.16.0.0 · Distribution.Simple.CompilerOrd fp => Ord (PackageDBX fp)Defined in Cabal-3.16.0.0 · Distribution.Simple.CompilerRead fp => Read (PackageDBX fp)Defined in Cabal-3.16.0.0 · Distribution.Simple.CompilerShow fp => Show (PackageDBX fp)Defined in Cabal-3.16.0.0 · Distribution.Simple.CompilerGeneric (PackageDBX fp)Defined in Cabal-3.16.0.0 · Distribution.Simple.CompilerBinary fp => Binary (PackageDBX fp)Defined in Cabal-3.16.0.0 · Distribution.Simple.CompilerStructured fp => Structured (PackageDBX fp)Defined in Cabal-3.16.0.0 · Distribution.Simple.Compilertype Rep (PackageDBX fp) = D1 ('MetaDataDefined in Cabal-3.16.0.0 · Distribution.Simple.Compiler"PackageDBX"
"Distribution.Simple.Compiler"
"Cabal-3.16.0.0-2669"
'False) (C1 ('MetaCons"GlobalPackageDB"
'PrefixI 'False) U1 :+: (C1 ('MetaCons"UserPackageDB"
'PrefixI 'False) U1 :+: C1 ('MetaCons"SpecificPackageDB"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 fp))))
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.
Return the package that we should register into. This is the package db at the top of the stack.
Make package paths absolute
Transform a package db using a FilePath into one using symbolic paths.
Support for optimisation levels
2 declarationsSome 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, …
Bounded OptimisationLevelDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerEnum OptimisationLevelDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerEq OptimisationLevelDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerRead OptimisationLevelDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerShow OptimisationLevelDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerGeneric OptimisationLevelDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerBinary OptimisationLevelDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerStructured OptimisationLevelDefined in Cabal-3.16.0.0 · Distribution.Simple.Compilertype Rep OptimisationLevel = D1 ('MetaDataDefined in Cabal-3.16.0.0 · Distribution.Simple.Compiler"OptimisationLevel"
"Distribution.Simple.Compiler"
"Cabal-3.16.0.0-2669"
'False) (C1 ('MetaCons"NoOptimisation"
'PrefixI 'False) U1 :+: (C1 ('MetaCons"NormalOptimisation"
'PrefixI 'False) U1 :+: C1 ('MetaCons"MaximumOptimisation"
'PrefixI 'False) U1))
Support for debug info levels
2 declarationsSome 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, …
Bounded DebugInfoLevelDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerEnum DebugInfoLevelDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerEq DebugInfoLevelDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerRead DebugInfoLevelDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerShow DebugInfoLevelDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerGeneric DebugInfoLevelDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerBinary DebugInfoLevelDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerStructured DebugInfoLevelDefined in Cabal-3.16.0.0 · Distribution.Simple.Compilertype Rep DebugInfoLevel = D1 ('MetaDataDefined in Cabal-3.16.0.0 · Distribution.Simple.Compiler"DebugInfoLevel"
"Distribution.Simple.Compiler"
"Cabal-3.16.0.0-2669"
'False) ((C1 ('MetaCons"NoDebugInfo"
'PrefixI 'False) U1 :+: C1 ('MetaCons"MinimalDebugInfo"
'PrefixI 'False) U1) :+: (C1 ('MetaCons"NormalDebugInfo"
'PrefixI 'False) U1 :+: C1 ('MetaCons"MaximalDebugInfo"
'PrefixI 'False) U1))
Support for language extensions
25 declarationsFor the given compiler, return the flags for the supported extensions.
For the given compiler, return the extensions it does not support.
Does this compiler support parallel --make mode?
Does this compiler support reexported-modules?
Does this compiler support thinning/renaming on package flags?
Does this compiler have unified IPIDs (so no package keys)
Does this compiler support package keys?
Does this compiler support unit IDs?
Does this compiler support Haskell program coverage?
Does this compiler support profiling?
Is the compiler distributed with profiling dynamic libraries
Either profiling dynamic is definitely supported or we don't know (so assume it is)
Is the compiler distributed with profiling libraries
Either profiling is definitely supported or we don't know (so assume it is)
Is the compiler distributed with dynamic libraries
Does this compiler support Backpack?
Does this compiler's "ar" command supports response file arguments (i.e. @file-style arguments).
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.
Does this compiler support a package database entry with: "dynamic-library-dirs"?
Does this compiler support a package database entry with: "visibility"?
Does this compiler support the -jsem option?
Does the compiler support the -reexported-modules "A as B" syntax
Support for profiling detail levels
4 declarationsSome 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, …
Eq ProfDetailLevelDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerRead ProfDetailLevelDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerShow ProfDetailLevelDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerGeneric ProfDetailLevelDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerBinary ProfDetailLevelDefined in Cabal-3.16.0.0 · Distribution.Simple.CompilerStructured ProfDetailLevelDefined in Cabal-3.16.0.0 · Distribution.Simple.Compilertype Rep ProfDetailLevel = D1 ('MetaDataDefined in Cabal-3.16.0.0 · Distribution.Simple.Compiler"ProfDetailLevel"
"Distribution.Simple.Compiler"
"Cabal-3.16.0.0-2669"
'False) ((C1 ('MetaCons"ProfDetailNone"
'PrefixI 'False) U1 :+: (C1 ('MetaCons"ProfDetailDefault"
'PrefixI 'False) U1 :+: C1 ('MetaCons"ProfDetailExportedFunctions"
'PrefixI 'False) U1)) :+: ((C1 ('MetaCons"ProfDetailToplevelFunctions"
'PrefixI 'False) U1 :+: C1 ('MetaCons"ProfDetailAllFunctions"
'PrefixI 'False) U1) :+: (C1 ('MetaCons"ProfDetailTopLate"
'PrefixI 'False) U1 :+: C1 ('MetaCons"ProfDetailOther"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))))