Distribution.Compiler

Cabal-3.0.0.0: A framework for packaging Haskell software

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

Distribution.Compiler

Contents

- Compiler flavor
- Per 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 progdb

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
  - | Eta
  - | HaskellSuite String
  - | OtherCompiler String
- buildCompilerId :: CompilerId
- buildCompilerFlavor :: CompilerFlavor
- defaultCompilerFlavor :: Maybe CompilerFlavor
- classifyCompilerFlavor :: String -> CompilerFlavor
- knownCompilerFlavors :: [CompilerFlavor]
- data PerCompilerFlavor v = PerCompilerFlavor v v
- perCompilerFlavorToList :: PerCompilerFlavor v -> [(CompilerFlavor, v)]
- 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 |
Eta |
HaskellSuite String |
OtherCompiler String |

#### Instances

Instances details

Eq CompilerFlavor # |
Instance details Defined in Distribution.Compiler Methods (==) :: CompilerFlavor -> CompilerFlavor -> Bool # (/=) :: CompilerFlavor -> CompilerFlavor -> Bool #
Data CompilerFlavor # |
Instance details Defined in Distribution.Compiler 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 :: forall r r'. (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 # |
Instance details Defined in Distribution.Compiler 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 # |
Instance details Defined in Distribution.Compiler Methods readsPrec :: Int -> ReadS CompilerFlavor Source # readList :: ReadS [CompilerFlavor] Source # readPrec :: ReadPrec CompilerFlavor Source # readListPrec :: ReadPrec [CompilerFlavor] Source #
Show CompilerFlavor # |
Instance details Defined in Distribution.Compiler Methods showsPrec :: Int -> CompilerFlavor -> ShowS Source # show :: CompilerFlavor -> String Source # showList :: [CompilerFlavor] -> ShowS Source #
Generic CompilerFlavor # |
Instance details Defined in Distribution.Compiler Associated Types type Rep CompilerFlavor :: Type -> Type Source # Methods from :: CompilerFlavor -> Rep CompilerFlavor x Source # to :: Rep CompilerFlavor x -> CompilerFlavor Source #
Binary CompilerFlavor # |
Instance details Defined in Distribution.Compiler Methods put :: CompilerFlavor -> Put Source # get :: Get CompilerFlavor Source # putList :: [CompilerFlavor] -> Put Source #
NFData CompilerFlavor # |
Instance details Defined in Distribution.Compiler Methods rnf :: CompilerFlavor -> () Source #
Pretty CompilerFlavor # |
Instance details Defined in Distribution.Compiler Methods pretty :: CompilerFlavor -> Doc Source # prettyVersioned :: CabalSpecVersion -> CompilerFlavor -> Doc Source #
Parsec CompilerFlavor # |
Instance details Defined in Distribution.Compiler Methods parsec :: CabalParsing m => m CompilerFlavor Source #
Newtype (CompilerFlavor, VersionRange) TestedWith # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pack :: (CompilerFlavor, VersionRange) -> TestedWith Source # unpack :: TestedWith -> (CompilerFlavor, VersionRange) Source #
type Rep CompilerFlavor # |
Instance details Defined in Distribution.Compiler type Rep CompilerFlavor = D1 ('MetaData "CompilerFlavor" "Distribution.Compiler" "Cabal-3.0.0.0" 'False) (((C1 ('MetaCons "GHC" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "GHCJS" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NHC" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "YHC" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Hugs" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "HBC" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "Helium" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "JHC" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LHC" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "UHC" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Eta" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "HaskellSuite" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :+: C1 ('MetaCons "OtherCompiler" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe 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.

classifyCompilerFlavor :: String -> CompilerFlavor Source #

knownCompilerFlavors :: [CompilerFlavor] Source #

# Per compiler flavor

data PerCompilerFlavor v Source #

`PerCompilerFlavor` carries only info per GHC and GHCJS

Cabal parses only `ghc-options` and `ghcjs-options`, others are omitted.

Constructors

PerCompilerFlavor v v |

#### Instances

Instances details

Eq v => Eq (PerCompilerFlavor v) # |
Instance details Defined in Distribution.Compiler Methods (==) :: PerCompilerFlavor v -> PerCompilerFlavor v -> Bool # (/=) :: PerCompilerFlavor v -> PerCompilerFlavor v -> Bool #
Data v => Data (PerCompilerFlavor v) # |
Instance details Defined in Distribution.Compiler Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PerCompilerFlavor v -> c (PerCompilerFlavor v) Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (PerCompilerFlavor v) Source # toConstr :: PerCompilerFlavor v -> Constr Source # dataTypeOf :: PerCompilerFlavor v -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (PerCompilerFlavor v)) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (PerCompilerFlavor v)) Source # gmapT :: (forall b. Data b => b -> b) -> PerCompilerFlavor v -> PerCompilerFlavor v Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PerCompilerFlavor v -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PerCompilerFlavor v -> r Source # gmapQ :: (forall d. Data d => d -> u) -> PerCompilerFlavor v -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> PerCompilerFlavor v -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> PerCompilerFlavor v -> m (PerCompilerFlavor v) Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PerCompilerFlavor v -> m (PerCompilerFlavor v) Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PerCompilerFlavor v -> m (PerCompilerFlavor v) Source #
Read v => Read (PerCompilerFlavor v) # |
Instance details Defined in Distribution.Compiler Methods readsPrec :: Int -> ReadS (PerCompilerFlavor v) Source # readList :: ReadS [PerCompilerFlavor v] Source # readPrec :: ReadPrec (PerCompilerFlavor v) Source # readListPrec :: ReadPrec [PerCompilerFlavor v] Source #
Show v => Show (PerCompilerFlavor v) # |
Instance details Defined in Distribution.Compiler Methods showsPrec :: Int -> PerCompilerFlavor v -> ShowS Source # show :: PerCompilerFlavor v -> String Source # showList :: [PerCompilerFlavor v] -> ShowS Source #
Generic (PerCompilerFlavor v) # |
Instance details Defined in Distribution.Compiler Associated Types type Rep (PerCompilerFlavor v) :: Type -> Type Source # Methods from :: PerCompilerFlavor v -> Rep (PerCompilerFlavor v) x Source # to :: Rep (PerCompilerFlavor v) x -> PerCompilerFlavor v Source #
Semigroup a => Semigroup (PerCompilerFlavor a) # |
Instance details Defined in Distribution.Compiler Methods (<>) :: PerCompilerFlavor a -> PerCompilerFlavor a -> PerCompilerFlavor a Source # sconcat :: NonEmpty (PerCompilerFlavor a) -> PerCompilerFlavor a Source # stimes :: Integral b => b -> PerCompilerFlavor a -> PerCompilerFlavor a Source #
(Semigroup a, Monoid a) => Monoid (PerCompilerFlavor a) # |
Instance details Defined in Distribution.Compiler Methods mempty :: PerCompilerFlavor a Source # mappend :: PerCompilerFlavor a -> PerCompilerFlavor a -> PerCompilerFlavor a Source # mconcat :: [PerCompilerFlavor a] -> PerCompilerFlavor a Source #
Binary a => Binary (PerCompilerFlavor a) # |
Instance details Defined in Distribution.Compiler Methods put :: PerCompilerFlavor a -> Put Source # get :: Get (PerCompilerFlavor a) Source # putList :: [PerCompilerFlavor a] -> Put Source #
NFData a => NFData (PerCompilerFlavor a) # |
Instance details Defined in Distribution.Compiler Methods rnf :: PerCompilerFlavor a -> () Source #
type Rep (PerCompilerFlavor v) # |
Instance details Defined in Distribution.Compiler type Rep (PerCompilerFlavor v) = D1 ('MetaData "PerCompilerFlavor" "Distribution.Compiler" "Cabal-3.0.0.0" 'False) (C1 ('MetaCons "PerCompilerFlavor" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 v) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 v)))

perCompilerFlavorToList :: PerCompilerFlavor v -> [(CompilerFlavor, v)] Source #

# Compiler id

data CompilerId Source #

Constructors

CompilerId CompilerFlavor Version |

#### Instances

Instances details

Eq CompilerId # |
Instance details Defined in Distribution.Compiler Methods (==) :: CompilerId -> CompilerId -> Bool # (/=) :: CompilerId -> CompilerId -> Bool #
Ord CompilerId # |
Instance details Defined in Distribution.Compiler 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 # |
Instance details Defined in Distribution.Compiler Methods readsPrec :: Int -> ReadS CompilerId Source # readList :: ReadS [CompilerId] Source # readPrec :: ReadPrec CompilerId Source # readListPrec :: ReadPrec [CompilerId] Source #
Show CompilerId # |
Instance details Defined in Distribution.Compiler Methods showsPrec :: Int -> CompilerId -> ShowS Source # show :: CompilerId -> String Source # showList :: [CompilerId] -> ShowS Source #
Generic CompilerId # |
Instance details Defined in Distribution.Compiler Associated Types type Rep CompilerId :: Type -> Type Source # Methods from :: CompilerId -> Rep CompilerId x Source # to :: Rep CompilerId x -> CompilerId Source #
Binary CompilerId # |
Instance details Defined in Distribution.Compiler Methods put :: CompilerId -> Put Source # get :: Get CompilerId Source # putList :: [CompilerId] -> Put Source #
NFData CompilerId # |
Instance details Defined in Distribution.Compiler Methods rnf :: CompilerId -> () Source #
Pretty CompilerId # |
Instance details Defined in Distribution.Compiler Methods pretty :: CompilerId -> Doc Source # prettyVersioned :: CabalSpecVersion -> CompilerId -> Doc Source #
Parsec CompilerId # |
Instance details Defined in Distribution.Compiler Methods parsec :: CabalParsing m => m CompilerId Source #
type Rep CompilerId # |
Instance details Defined in Distribution.Compiler type Rep CompilerId = D1 ('MetaData "CompilerId" "Distribution.Compiler" "Cabal-3.0.0.0" 'False) (C1 ('MetaCons "CompilerId" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CompilerFlavor) :*: S1 ('MetaSel ('Nothing :: Maybe 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

Instances details

Read CompilerInfo # |
Instance details Defined in Distribution.Compiler Methods readsPrec :: Int -> ReadS CompilerInfo Source # readList :: ReadS [CompilerInfo] Source # readPrec :: ReadPrec CompilerInfo Source # readListPrec :: ReadPrec [CompilerInfo] Source #
Show CompilerInfo # |
Instance details Defined in Distribution.Compiler Methods showsPrec :: Int -> CompilerInfo -> ShowS Source # show :: CompilerInfo -> String Source # showList :: [CompilerInfo] -> ShowS Source #
Generic CompilerInfo # |
Instance details Defined in Distribution.Compiler Associated Types type Rep CompilerInfo :: Type -> Type Source # Methods from :: CompilerInfo -> Rep CompilerInfo x Source # to :: Rep CompilerInfo x -> CompilerInfo Source #
Binary CompilerInfo # |
Instance details Defined in Distribution.Compiler Methods put :: CompilerInfo -> Put Source # get :: Get CompilerInfo Source # putList :: [CompilerInfo] -> Put Source #
type Rep CompilerInfo # |
Instance details Defined in Distribution.Compiler type Rep CompilerInfo = D1 ('MetaData "CompilerInfo" "Distribution.Compiler" "Cabal-3.0.0.0" 'False) (C1 ('MetaCons "CompilerInfo" 'PrefixI 'True) ((S1 ('MetaSel ('Just "compilerInfoId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CompilerId) :*: S1 ('MetaSel ('Just "compilerInfoAbiTag") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AbiTag)) :*: (S1 ('MetaSel ('Just "compilerInfoCompat") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe [CompilerId])) :*: (S1 ('MetaSel ('Just "compilerInfoLanguages") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe [Language])) :*: S1 ('MetaSel ('Just "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

Instances details

Eq AbiTag # |
Instance details Defined in Distribution.Compiler Methods (==) :: AbiTag -> AbiTag -> Bool # (/=) :: AbiTag -> AbiTag -> Bool #
Read AbiTag # |
Instance details Defined in Distribution.Compiler Methods readsPrec :: Int -> ReadS AbiTag Source # readList :: ReadS [AbiTag] Source # readPrec :: ReadPrec AbiTag Source # readListPrec :: ReadPrec [AbiTag] Source #
Show AbiTag # |
Instance details Defined in Distribution.Compiler Methods showsPrec :: Int -> AbiTag -> ShowS Source # show :: AbiTag -> String Source # showList :: [AbiTag] -> ShowS Source #
Generic AbiTag # |
Instance details Defined in Distribution.Compiler Associated Types type Rep AbiTag :: Type -> Type Source # Methods from :: AbiTag -> Rep AbiTag x Source # to :: Rep AbiTag x -> AbiTag Source #
Binary AbiTag # |
Instance details Defined in Distribution.Compiler Methods put :: AbiTag -> Put Source # get :: Get AbiTag Source # putList :: [AbiTag] -> Put Source #
Pretty AbiTag # |
Instance details Defined in Distribution.Compiler Methods pretty :: AbiTag -> Doc Source # prettyVersioned :: CabalSpecVersion -> AbiTag -> Doc Source #
Parsec AbiTag # |
Instance details Defined in Distribution.Compiler Methods parsec :: CabalParsing m => m AbiTag Source #
type Rep AbiTag # |
Instance details Defined in Distribution.Compiler type Rep AbiTag = D1 ('MetaData "AbiTag" "Distribution.Compiler" "Cabal-3.0.0.0" 'False) (C1 ('MetaCons "NoAbiTag" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "AbiTag" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))

abiTagString :: AbiTag -> String Source #