Distribution.Compiler

Cabal-1.24.1.0: A framework for packaging Haskell software

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

Distribution.Compiler

Contents

- Compiler flavor
- Compiler id
- Compiler info

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
  - | GHCJS
  - | NHC
  - | YHC
  - | Hugs
  - | HBC
  - | Helium
  - | JHC
  - | LHC
  - | UHC
  - | HaskellSuite String
  - | OtherCompiler String
- buildCompilerId :: CompilerId
- buildCompilerFlavor :: CompilerFlavor
- defaultCompilerFlavor :: Maybe CompilerFlavor
- parseCompilerFlavorCompat :: ReadP r CompilerFlavor
- data CompilerId = CompilerId CompilerFlavor Version
- data CompilerInfo = CompilerInfo {
  - compilerInfoId :: CompilerId
  - compilerInfoAbiTag :: AbiTag
  - compilerInfoCompat :: Maybe [CompilerId]
  - compilerInfoLanguages :: Maybe [Language]
  - compilerInfoExtensions :: Maybe [Extension]
  }
- unknownCompilerInfo :: CompilerId -> AbiTag -> CompilerInfo
- data AbiTag
  - = NoAbiTag
  - | AbiTag String
- abiTagString :: AbiTag -> String

# Compiler flavor

data CompilerFlavor Source #

Constructors

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

Instances

Eq CompilerFlavor # |
Methods (==) :: CompilerFlavor -> CompilerFlavor -> Bool # (/=) :: CompilerFlavor -> CompilerFlavor -> Bool #
Data CompilerFlavor # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CompilerFlavor -> c CompilerFlavor Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CompilerFlavor Source # toConstr :: CompilerFlavor -> Constr Source # dataTypeOf :: CompilerFlavor -> DataType Source # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c CompilerFlavor) Source # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CompilerFlavor) Source # gmapT :: (forall b. Data b => b -> b) -> CompilerFlavor -> CompilerFlavor Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CompilerFlavor -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CompilerFlavor -> r Source # gmapQ :: (forall d. Data d => d -> u) -> CompilerFlavor -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> CompilerFlavor -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CompilerFlavor -> m CompilerFlavor Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CompilerFlavor -> m CompilerFlavor Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CompilerFlavor -> m CompilerFlavor Source #
Ord CompilerFlavor # |
Methods compare :: CompilerFlavor -> CompilerFlavor -> Ordering # (<) :: CompilerFlavor -> CompilerFlavor -> Bool # (<=) :: CompilerFlavor -> CompilerFlavor -> Bool # (>) :: CompilerFlavor -> CompilerFlavor -> Bool # (>=) :: CompilerFlavor -> CompilerFlavor -> Bool # max :: CompilerFlavor -> CompilerFlavor -> CompilerFlavor # min :: CompilerFlavor -> CompilerFlavor -> CompilerFlavor #
Read CompilerFlavor # |
Methods readsPrec :: Int -> ReadS CompilerFlavor Source # readList :: ReadS [CompilerFlavor] Source # readPrec :: ReadPrec CompilerFlavor Source # readListPrec :: ReadPrec [CompilerFlavor] Source #
Show CompilerFlavor # |
Methods showsPrec :: Int -> CompilerFlavor -> ShowS Source # show :: CompilerFlavor -> String Source # showList :: [CompilerFlavor] -> ShowS Source #
Generic CompilerFlavor # |
Associated Types type Rep CompilerFlavor :: * -> * Source # Methods from :: CompilerFlavor -> Rep CompilerFlavor x Source # to :: Rep CompilerFlavor x -> CompilerFlavor Source #
Binary CompilerFlavor # |
Methods put :: CompilerFlavor -> Put Source # get :: Get CompilerFlavor Source # putList :: [CompilerFlavor] -> Put Source #
Text CompilerFlavor # |
Methods disp :: CompilerFlavor -> Doc Source # parse :: ReadP r CompilerFlavor Source #
type Rep CompilerFlavor # |
type Rep CompilerFlavor = D1 (MetaData "CompilerFlavor" "Distribution.Compiler" "Cabal-1.24.1.0" 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 "HaskellSuite" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String))) (C1 (MetaCons "OtherCompiler" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String)))))))

buildCompilerId :: CompilerId Source #

buildCompilerFlavor :: 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 #

Constructors

CompilerId CompilerFlavor Version |

Instances

Eq CompilerId # |
Methods (==) :: CompilerId -> CompilerId -> Bool # (/=) :: CompilerId -> CompilerId -> Bool #
Ord CompilerId # |
Methods compare :: CompilerId -> CompilerId -> Ordering # (<) :: CompilerId -> CompilerId -> Bool # (<=) :: CompilerId -> CompilerId -> Bool # (>) :: CompilerId -> CompilerId -> Bool # (>=) :: CompilerId -> CompilerId -> Bool # max :: CompilerId -> CompilerId -> CompilerId # min :: CompilerId -> CompilerId -> CompilerId #
Read CompilerId # |
Methods readsPrec :: Int -> ReadS CompilerId Source # readList :: ReadS [CompilerId] Source # readPrec :: ReadPrec CompilerId Source # readListPrec :: ReadPrec [CompilerId] Source #
Show CompilerId # |
Methods showsPrec :: Int -> CompilerId -> ShowS Source # show :: CompilerId -> String Source # showList :: [CompilerId] -> ShowS Source #
Generic CompilerId # |
Associated Types type Rep CompilerId :: * -> * Source # Methods from :: CompilerId -> Rep CompilerId x Source # to :: Rep CompilerId x -> CompilerId Source #
Binary CompilerId # |
Methods put :: CompilerId -> Put Source # get :: Get CompilerId Source # putList :: [CompilerId] -> Put Source #
Text CompilerId # |
Methods disp :: CompilerId -> Doc Source # parse :: ReadP r CompilerId Source #
type Rep CompilerId # |
type Rep CompilerId = D1 (MetaData "CompilerId" "Distribution.Compiler" "Cabal-1.24.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.

Constructors

CompilerInfo |
Fields compilerInfoId :: CompilerId Compiler flavour and version. compilerInfoAbiTag :: AbiTag Tag 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.

Instances

Read CompilerInfo # |
Methods readsPrec :: Int -> ReadS CompilerInfo Source # readList :: ReadS [CompilerInfo] Source # readPrec :: ReadPrec CompilerInfo Source # readListPrec :: ReadPrec [CompilerInfo] Source #
Show CompilerInfo # |
Methods showsPrec :: Int -> CompilerInfo -> ShowS Source # show :: CompilerInfo -> String Source # showList :: [CompilerInfo] -> ShowS Source #
Generic CompilerInfo # |
Associated Types type Rep CompilerInfo :: * -> * Source # Methods from :: CompilerInfo -> Rep CompilerInfo x Source # to :: Rep CompilerInfo x -> CompilerInfo Source #
Binary CompilerInfo # |
Methods put :: CompilerInfo -> Put Source # get :: Get CompilerInfo Source # putList :: [CompilerInfo] -> Put Source #
type Rep CompilerInfo # |
type Rep CompilerInfo = D1 (MetaData "CompilerInfo" "Distribution.Compiler" "Cabal-1.24.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.

data AbiTag Source #

Constructors

NoAbiTag |
AbiTag String |

Instances

Eq AbiTag # |
Methods (==) :: AbiTag -> AbiTag -> Bool # (/=) :: AbiTag -> AbiTag -> Bool #
Read AbiTag # |
Methods readsPrec :: Int -> ReadS AbiTag Source # readList :: ReadS [AbiTag] Source # readPrec :: ReadPrec AbiTag Source # readListPrec :: ReadPrec [AbiTag] Source #
Show AbiTag # |
Methods showsPrec :: Int -> AbiTag -> ShowS Source # show :: AbiTag -> String Source # showList :: [AbiTag] -> ShowS Source #
Generic AbiTag # |
Associated Types type Rep AbiTag :: * -> * Source # Methods from :: AbiTag -> Rep AbiTag x Source # to :: Rep AbiTag x -> AbiTag Source #
Binary AbiTag # |
Methods put :: AbiTag -> Put Source # get :: Get AbiTag Source # putList :: [AbiTag] -> Put Source #
Text AbiTag # |
Methods disp :: AbiTag -> Doc Source # parse :: ReadP r AbiTag Source #
type Rep AbiTag # |
type Rep AbiTag = D1 (MetaData "AbiTag" "Distribution.Compiler" "Cabal-1.24.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 #