Cabal-3.10.2.0: A framework for packaging Haskell software
CopyrightIsaac Jones 2003-2004
LicenseBSD3
Maintainercabal-devel@haskell.org
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Distribution.Simple.Compiler

Description

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.

Synopsis

Haskell implementations

data Compiler Source #

Constructors

Compiler 

Fields

Instances

Instances details
Structured Compiler Source # 
Instance details

Defined in Distribution.Simple.Compiler

Generic Compiler Source # 
Instance details

Defined in Distribution.Simple.Compiler

Associated Types

type Rep Compiler 
Instance details

Defined in Distribution.Simple.Compiler

Read Compiler Source # 
Instance details

Defined in Distribution.Simple.Compiler

Show Compiler Source # 
Instance details

Defined in Distribution.Simple.Compiler

Binary Compiler Source # 
Instance details

Defined in Distribution.Simple.Compiler

Methods

put :: Compiler -> Put #

get :: Get Compiler #

putList :: [Compiler] -> Put #

Eq Compiler Source # 
Instance details

Defined in Distribution.Simple.Compiler

type Rep Compiler Source # 
Instance details

Defined in Distribution.Simple.Compiler

compilerCompatFlavor :: CompilerFlavor -> Compiler -> Bool Source #

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

compilerCompatVersion :: CompilerFlavor -> Compiler -> Maybe Version Source #

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

data PackageDB Source #

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.

Instances

Instances details
Structured PackageDB Source # 
Instance details

Defined in Distribution.Simple.Compiler

Generic PackageDB Source # 
Instance details

Defined in Distribution.Simple.Compiler

Associated Types

type Rep PackageDB 
Instance details

Defined in Distribution.Simple.Compiler

type Rep PackageDB = D1 ('MetaData "PackageDB" "Distribution.Simple.Compiler" "Cabal-3.10.2.0-fb31" 'False) (C1 ('MetaCons "GlobalPackageDB" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "UserPackageDB" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SpecificPackageDB" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath))))
Read PackageDB Source # 
Instance details

Defined in Distribution.Simple.Compiler

Show PackageDB Source # 
Instance details

Defined in Distribution.Simple.Compiler

Binary PackageDB Source # 
Instance details

Defined in Distribution.Simple.Compiler

Methods

put :: PackageDB -> Put #

get :: Get PackageDB #

putList :: [PackageDB] -> Put #

Eq PackageDB Source # 
Instance details

Defined in Distribution.Simple.Compiler

Ord PackageDB Source # 
Instance details

Defined in Distribution.Simple.Compiler

type Rep PackageDB Source # 
Instance details

Defined in Distribution.Simple.Compiler

type Rep PackageDB = D1 ('MetaData "PackageDB" "Distribution.Simple.Compiler" "Cabal-3.10.2.0-fb31" 'False) (C1 ('MetaCons "GlobalPackageDB" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "UserPackageDB" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SpecificPackageDB" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath))))

type PackageDBStack = [PackageDB] Source #

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.

registrationPackageDB :: PackageDBStack -> PackageDB Source #

Return the package that we should register into. This is the package db at the top of the stack.

Support for optimisation levels

data OptimisationLevel Source #

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

Instances

Instances details
Structured OptimisationLevel Source # 
Instance details

Defined in Distribution.Simple.Compiler

Bounded OptimisationLevel Source # 
Instance details

Defined in Distribution.Simple.Compiler

Enum OptimisationLevel Source # 
Instance details

Defined in Distribution.Simple.Compiler

Generic OptimisationLevel Source # 
Instance details

Defined in Distribution.Simple.Compiler

Associated Types

type Rep OptimisationLevel 
Instance details

Defined in Distribution.Simple.Compiler

type Rep OptimisationLevel = D1 ('MetaData "OptimisationLevel" "Distribution.Simple.Compiler" "Cabal-3.10.2.0-fb31" 'False) (C1 ('MetaCons "NoOptimisation" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "NormalOptimisation" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MaximumOptimisation" 'PrefixI 'False) (U1 :: Type -> Type)))
Read OptimisationLevel Source # 
Instance details

Defined in Distribution.Simple.Compiler

Show OptimisationLevel Source # 
Instance details

Defined in Distribution.Simple.Compiler

Binary OptimisationLevel Source # 
Instance details

Defined in Distribution.Simple.Compiler

Eq OptimisationLevel Source # 
Instance details

Defined in Distribution.Simple.Compiler

type Rep OptimisationLevel Source # 
Instance details

Defined in Distribution.Simple.Compiler

type Rep OptimisationLevel = D1 ('MetaData "OptimisationLevel" "Distribution.Simple.Compiler" "Cabal-3.10.2.0-fb31" 'False) (C1 ('MetaCons "NoOptimisation" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "NormalOptimisation" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MaximumOptimisation" 'PrefixI 'False) (U1 :: Type -> Type)))

Support for debug info levels

data DebugInfoLevel Source #

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.

Instances

Instances details
Structured DebugInfoLevel Source # 
Instance details

Defined in Distribution.Simple.Compiler

Bounded DebugInfoLevel Source # 
Instance details

Defined in Distribution.Simple.Compiler

Enum DebugInfoLevel Source # 
Instance details

Defined in Distribution.Simple.Compiler

Generic DebugInfoLevel Source # 
Instance details

Defined in Distribution.Simple.Compiler

Associated Types

type Rep DebugInfoLevel 
Instance details

Defined in Distribution.Simple.Compiler

type Rep DebugInfoLevel = D1 ('MetaData "DebugInfoLevel" "Distribution.Simple.Compiler" "Cabal-3.10.2.0-fb31" 'False) ((C1 ('MetaCons "NoDebugInfo" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MinimalDebugInfo" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "NormalDebugInfo" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MaximalDebugInfo" 'PrefixI 'False) (U1 :: Type -> Type)))
Read DebugInfoLevel Source # 
Instance details

Defined in Distribution.Simple.Compiler

Show DebugInfoLevel Source # 
Instance details

Defined in Distribution.Simple.Compiler

Binary DebugInfoLevel Source # 
Instance details

Defined in Distribution.Simple.Compiler

Methods

put :: DebugInfoLevel -> Put #

get :: Get DebugInfoLevel #

putList :: [DebugInfoLevel] -> Put #

Eq DebugInfoLevel Source # 
Instance details

Defined in Distribution.Simple.Compiler

type Rep DebugInfoLevel Source # 
Instance details

Defined in Distribution.Simple.Compiler

type Rep DebugInfoLevel = D1 ('MetaData "DebugInfoLevel" "Distribution.Simple.Compiler" "Cabal-3.10.2.0-fb31" 'False) ((C1 ('MetaCons "NoDebugInfo" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MinimalDebugInfo" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "NormalDebugInfo" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MaximalDebugInfo" 'PrefixI 'False) (U1 :: Type -> Type)))

Support for language extensions

extensionsToFlags :: Compiler -> [Extension] -> [CompilerFlag] Source #

For the given compiler, return the flags for the supported extensions.

unsupportedExtensions :: Compiler -> [Extension] -> [Extension] Source #

For the given compiler, return the extensions it does not support.

parmakeSupported :: Compiler -> Bool Source #

Does this compiler support parallel --make mode?

reexportedModulesSupported :: Compiler -> Bool Source #

Does this compiler support reexported-modules?

renamingPackageFlagsSupported :: Compiler -> Bool Source #

Does this compiler support thinning/renaming on package flags?

unifiedIPIDRequired :: Compiler -> Bool Source #

Does this compiler have unified IPIDs (so no package keys)

packageKeySupported :: Compiler -> Bool Source #

Does this compiler support package keys?

unitIdSupported :: Compiler -> Bool Source #

Does this compiler support unit IDs?

coverageSupported :: Compiler -> Bool Source #

Does this compiler support Haskell program coverage?

profilingSupported :: Compiler -> Bool Source #

Does this compiler support profiling?

backpackSupported :: Compiler -> Bool Source #

Does this compiler support Backpack?

arResponseFilesSupported :: Compiler -> Bool Source #

Does this compiler's "ar" command supports response file arguments (i.e. @file-style arguments).

arDashLSupported :: Compiler -> Bool Source #

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.

libraryDynDirSupported :: Compiler -> Bool Source #

Does this compiler support a package database entry with: "dynamic-library-dirs"?

libraryVisibilitySupported :: Compiler -> Bool Source #

Does this compiler support a package database entry with: "visibility"?

Support for profiling detail levels

data ProfDetailLevel Source #

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.

Instances

Instances details
Structured ProfDetailLevel Source # 
Instance details

Defined in Distribution.Simple.Compiler

Generic ProfDetailLevel Source # 
Instance details

Defined in Distribution.Simple.Compiler

Associated Types

type Rep ProfDetailLevel 
Instance details

Defined in Distribution.Simple.Compiler

type Rep ProfDetailLevel = D1 ('MetaData "ProfDetailLevel" "Distribution.Simple.Compiler" "Cabal-3.10.2.0-fb31" 'False) ((C1 ('MetaCons "ProfDetailNone" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ProfDetailDefault" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ProfDetailExportedFunctions" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "ProfDetailToplevelFunctions" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ProfDetailAllFunctions" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ProfDetailTopLate" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ProfDetailOther" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))))
Read ProfDetailLevel Source # 
Instance details

Defined in Distribution.Simple.Compiler

Show ProfDetailLevel Source # 
Instance details

Defined in Distribution.Simple.Compiler

Binary ProfDetailLevel Source # 
Instance details

Defined in Distribution.Simple.Compiler

Methods

put :: ProfDetailLevel -> Put #

get :: Get ProfDetailLevel #

putList :: [ProfDetailLevel] -> Put #

Eq ProfDetailLevel Source # 
Instance details

Defined in Distribution.Simple.Compiler

type Rep ProfDetailLevel Source # 
Instance details

Defined in Distribution.Simple.Compiler

type Rep ProfDetailLevel = D1 ('MetaData "ProfDetailLevel" "Distribution.Simple.Compiler" "Cabal-3.10.2.0-fb31" 'False) ((C1 ('MetaCons "ProfDetailNone" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ProfDetailDefault" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ProfDetailExportedFunctions" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "ProfDetailToplevelFunctions" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ProfDetailAllFunctions" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ProfDetailTopLate" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ProfDetailOther" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))))