| Cabal-1.6.0.3: A framework for packaging Haskell software | Source code | Contents | Index

Distribution.Simple.Compiler

Portability | portable
Maintainer | cabal-devel@haskell.org

Contents

Haskell implementations
Support for package databases
Support for optimisation levels
Support for language extensions

Description

This should be a much more sophisticated abstraction than it is. Currently it's just a bit of data about the compiler, like it's 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

module Distribution.Compiler

data Compiler = Compiler {

compilerId :: CompilerId
compilerExtensions :: [(Extension, String)]

}

showCompilerId :: Compiler -> String
compilerFlavor :: Compiler -> CompilerFlavor
compilerVersion :: Compiler -> Version

data PackageDB

= GlobalPackageDB
| UserPackageDB
| SpecificPackageDB FilePath

data OptimisationLevel

= NoOptimisation
| NormalOptimisation
| MaximumOptimisation

flagToOptimisationLevel :: Maybe String -> OptimisationLevel
type Flag = String
extensionsToFlags :: Compiler -> [Extension] -> [Flag]
unsupportedExtensions :: Compiler -> [Extension] -> [Extension]

Haskell implementations
module Distribution.Compiler

data Compiler | Source

Constructors

Compiler |

compilerId :: CompilerId |
compilerExtensions :: [(Extension, String)] |

Instances

Read Compiler
Show Compiler

showCompilerId :: Compiler -> String | Source

compilerFlavor :: Compiler -> CompilerFlavor | Source

compilerVersion :: Compiler -> Version | Source

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 isloated environments of packages, for example to build a collection of related packages without installing them globally.
Constructors

GlobalPackageDB |
UserPackageDB |
SpecificPackageDB FilePath |

Instances

Eq PackageDB
Read PackageDB
Show PackageDB

Support for optimisation levels

data OptimisationLevel | Source

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

NoOptimisation |
NormalOptimisation |
MaximumOptimisation |

Instances

Bounded OptimisationLevel
Enum OptimisationLevel
Eq OptimisationLevel
Read OptimisationLevel
Show OptimisationLevel

flagToOptimisationLevel :: Maybe String -> OptimisationLevel | Source

Support for language extensions

type Flag = String | Source

extensionsToFlags :: Compiler -> [Extension] -> [Flag] | 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.
Produced by Haddock version 2.4.2