Cabal-1.18.1.5: A framework for packaging Haskell software

Copyright | Isaac Jones 2003-2004
Maintainer | cabal-devel@haskell.org
Portability | portable
Safe Haskell | Safe-Inferred
Language | Haskell98

Distribution.Compiler

Contents

- Compiler flavor
- Compiler id

Description

This has an enumeration of the various compilers that Cabal knows about. It also specifies the default compiler. Sadly you'll often see code that does case analysis on this compiler flavour enumeration like:

    case compilerFlavor comp of
      GHC -> GHC.getInstalledPackages verbosity packageDb progconf
      JHC -> JHC.getInstalledPackages verbosity packageDb progconf

Obviously it would be better to use the proper `Compiler` abstraction because that would keep all the compiler-specific code together. Unfortunately we cannot make this change yet without breaking the `UserHooks` api, which would break all custom `Setup.hs` files, so for the moment we just have to live with this deficiency. If you're interested, see ticket #57.

Synopsis

- data CompilerFlavor
  - = GHC
  - | NHC
  - | YHC
  - | Hugs
  - | HBC
  - | Helium
  - | JHC
  - | LHC
  - | UHC
  - | OtherCompiler String
- buildCompilerId :: CompilerId
- buildCompilerFlavor :: CompilerFlavor
- defaultCompilerFlavor :: Maybe CompilerFlavor
- parseCompilerFlavorCompat :: ReadP r CompilerFlavor
- data CompilerId = CompilerId CompilerFlavor Version

# Compiler flavor

data CompilerFlavor

Constructors

GHC |
NHC |
YHC |
Hugs |
HBC |
Helium |
JHC |
LHC |
UHC |
OtherCompiler String |

Instances

Eq CompilerFlavor |
Data CompilerFlavor |
Ord CompilerFlavor |
Read CompilerFlavor |
Show CompilerFlavor |
Text CompilerFlavor |
Typeable * CompilerFlavor |

buildCompilerId :: CompilerId

buildCompilerFlavor :: CompilerFlavor

defaultCompilerFlavor :: Maybe CompilerFlavor

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.

parseCompilerFlavorCompat :: ReadP r CompilerFlavor

Like `classifyCompilerFlavor` but compatible with the old ReadS parser.

It is compatible in the sense that it accepts only the same strings, eg GHC but not "ghc". However other strings get mapped to `OtherCompiler`. The point of this is that we do not allow extra valid values that would upset older Cabal versions that had a stricter parser however we cope with new values more gracefully so that we'll be able to introduce new value in future without breaking things so much.

# Compiler id

data CompilerId

Constructors

CompilerId CompilerFlavor Version |

Instances

Eq CompilerId |
Ord CompilerId |
Read CompilerId |
Show CompilerId |
Text CompilerId |