Copyright | Isaac Jones 2003-2004 |
---|---|
License | BSD3 |
Maintainer | cabal-devel@haskell.org |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell98 |
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.
- data CompilerFlavor
- buildCompilerId :: CompilerId
- buildCompilerFlavor :: CompilerFlavor
- defaultCompilerFlavor :: Maybe CompilerFlavor
- parseCompilerFlavorCompat :: ReadP r CompilerFlavor
- data CompilerId = CompilerId CompilerFlavor Version
- data CompilerInfo = CompilerInfo {}
- unknownCompilerInfo :: CompilerId -> AbiTag -> CompilerInfo
- data AbiTag
- abiTagString :: AbiTag -> String
Compiler flavor
data CompilerFlavor Source
defaultCompilerFlavor :: Maybe CompilerFlavor Source
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 Source
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 Source
Eq CompilerId | |
Ord CompilerId | |
Read CompilerId | |
Show CompilerId | |
Generic CompilerId | |
Binary CompilerId | |
Text CompilerId | |
type Rep CompilerId = D1 (MetaData "CompilerId" "Distribution.Compiler" "Cabal-1.23.1.0" False) (C1 (MetaCons "CompilerId" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 CompilerFlavor)) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Version)))) |
Compiler info
data CompilerInfo Source
Compiler information used for resolving configurations. Some fields can be set to Nothing to indicate that the information is unknown.
CompilerInfo | |
|
Read CompilerInfo | |
Show CompilerInfo | |
Generic CompilerInfo | |
Binary CompilerInfo | |
type Rep CompilerInfo = D1 (MetaData "CompilerInfo" "Distribution.Compiler" "Cabal-1.23.1.0" False) (C1 (MetaCons "CompilerInfo" PrefixI True) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "compilerInfoId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 CompilerId)) (S1 (MetaSel (Just Symbol "compilerInfoAbiTag") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 AbiTag))) ((:*:) (S1 (MetaSel (Just Symbol "compilerInfoCompat") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe [CompilerId]))) ((:*:) (S1 (MetaSel (Just Symbol "compilerInfoLanguages") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe [Language]))) (S1 (MetaSel (Just Symbol "compilerInfoExtensions") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe [Extension]))))))) |
unknownCompilerInfo :: CompilerId -> AbiTag -> CompilerInfo Source
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.
Eq AbiTag | |
Read AbiTag | |
Show AbiTag | |
Generic AbiTag | |
Binary AbiTag | |
Text AbiTag | |
type Rep AbiTag = D1 (MetaData "AbiTag" "Distribution.Compiler" "Cabal-1.23.1.0" False) ((:+:) (C1 (MetaCons "NoAbiTag" PrefixI False) U1) (C1 (MetaCons "AbiTag" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String)))) |
abiTagString :: AbiTag -> String Source