Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data PackageFlag = MkPackageFlag {}
- emptyFlag :: FlagName -> PackageFlag
- data FlagName
- mkFlagName :: String -> FlagName
- unFlagName :: FlagName -> String
- data FlagAssignment
- mkFlagAssignment :: [(FlagName, Bool)] -> FlagAssignment
- unFlagAssignment :: FlagAssignment -> [(FlagName, Bool)]
- lookupFlagAssignment :: FlagName -> FlagAssignment -> Maybe Bool
- insertFlagAssignment :: FlagName -> Bool -> FlagAssignment -> FlagAssignment
- diffFlagAssignment :: FlagAssignment -> FlagAssignment -> FlagAssignment
- findDuplicateFlagAssignments :: FlagAssignment -> [FlagName]
- nullFlagAssignment :: FlagAssignment -> Bool
- showFlagValue :: (FlagName, Bool) -> String
- dispFlagAssignment :: FlagAssignment -> Doc
- showFlagAssignment :: FlagAssignment -> String
- parsecFlagAssignment :: CabalParsing m => m FlagAssignment
- parsecFlagAssignmentNonEmpty :: CabalParsing m => m FlagAssignment
- legacyShowFlagAssignment :: FlagAssignment -> String
- legacyShowFlagAssignment' :: FlagAssignment -> [String]
- legacyParsecFlagAssignment :: CabalParsing m => m FlagAssignment
Package flag
data PackageFlag Source #
A flag can represent a feature to be included, or a way of linking a target against its dependencies, or in fact whatever you can think of.
MkPackageFlag | |
|
Instances
emptyFlag :: FlagName -> PackageFlag Source #
A PackageFlag
initialized with default parameters.
Flag name
A FlagName
is the name of a user-defined configuration flag
Use mkFlagName
and unFlagName
to convert from/to a String
.
This type is opaque since Cabal-2.0
Since: Cabal-syntax-2.0.0.2
Instances
Parsec FlagName Source # | |||||
Defined in Distribution.Types.Flag parsec :: CabalParsing m => m FlagName Source # | |||||
Pretty FlagName Source # | |||||
Defined in Distribution.Types.Flag | |||||
Structured FlagName Source # | |||||
Defined in Distribution.Types.Flag | |||||
Binary FlagName Source # | |||||
NFData FlagName Source # | |||||
Defined in Distribution.Types.Flag | |||||
Data FlagName Source # | |||||
Defined in Distribution.Types.Flag gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> FlagName -> c FlagName # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c FlagName # toConstr :: FlagName -> Constr # dataTypeOf :: FlagName -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c FlagName) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FlagName) # gmapT :: (forall b. Data b => b -> b) -> FlagName -> FlagName # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FlagName -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FlagName -> r # gmapQ :: (forall d. Data d => d -> u) -> FlagName -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> FlagName -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> FlagName -> m FlagName # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> FlagName -> m FlagName # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> FlagName -> m FlagName # | |||||
IsString FlagName Source # | Since: Cabal-syntax-2.0.0.2 | ||||
Defined in Distribution.Types.Flag fromString :: String -> FlagName # | |||||
Generic FlagName Source # | |||||
Defined in Distribution.Types.Flag
| |||||
Read FlagName Source # | |||||
Show FlagName Source # | |||||
Eq FlagName Source # | |||||
Ord FlagName Source # | |||||
Defined in Distribution.Types.Flag | |||||
type Rep FlagName Source # | |||||
Defined in Distribution.Types.Flag |
mkFlagName :: String -> FlagName Source #
Construct a FlagName
from a String
mkFlagName
is the inverse to unFlagName
Note: No validations are performed to ensure that the resulting
FlagName
is valid
Since: Cabal-syntax-2.0.0.2
Flag assignment
data FlagAssignment Source #
A FlagAssignment
is a total or partial mapping of FlagName
s to
Bool
flag values. It represents the flags chosen by the user or
discovered during configuration. For example --flags=foo --flags=-bar
becomes [("foo", True), ("bar", False)]
TODO: Why we record the multiplicity of the flag?
Instances
Parsec FlagAssignment Source # |
Issue #7279 was fixed in Cabal-3.8
Since: Cabal-syntax-3.4.0.0 | ||||
Defined in Distribution.Types.Flag parsec :: CabalParsing m => m FlagAssignment Source # | |||||
Pretty FlagAssignment Source # | Since: Cabal-syntax-3.4.0.0 | ||||
Defined in Distribution.Types.Flag pretty :: FlagAssignment -> Doc Source # prettyVersioned :: CabalSpecVersion -> FlagAssignment -> Doc Source # | |||||
Structured FlagAssignment Source # | |||||
Defined in Distribution.Types.Flag structure :: Proxy FlagAssignment -> Structure Source # structureHash' :: Tagged FlagAssignment MD5 | |||||
Binary FlagAssignment Source # | |||||
Defined in Distribution.Types.Flag put :: FlagAssignment -> Put Source # get :: Get FlagAssignment Source # putList :: [FlagAssignment] -> Put Source # | |||||
NFData FlagAssignment Source # | |||||
Defined in Distribution.Types.Flag rnf :: FlagAssignment -> () Source # | |||||
Monoid FlagAssignment Source # | |||||
Defined in Distribution.Types.Flag mappend :: FlagAssignment -> FlagAssignment -> FlagAssignment # mconcat :: [FlagAssignment] -> FlagAssignment # | |||||
Semigroup FlagAssignment Source # | |||||
Defined in Distribution.Types.Flag (<>) :: FlagAssignment -> FlagAssignment -> FlagAssignment # sconcat :: NonEmpty FlagAssignment -> FlagAssignment # stimes :: Integral b => b -> FlagAssignment -> FlagAssignment # | |||||
Generic FlagAssignment Source # | |||||
Defined in Distribution.Types.Flag
from :: FlagAssignment -> Rep FlagAssignment x # to :: Rep FlagAssignment x -> FlagAssignment # | |||||
Read FlagAssignment Source # | Since: Cabal-syntax-2.2.0 | ||||
Defined in Distribution.Types.Flag readsPrec :: Int -> ReadS FlagAssignment # readList :: ReadS [FlagAssignment] # | |||||
Show FlagAssignment Source # | Since: Cabal-syntax-2.2.0 | ||||
Defined in Distribution.Types.Flag showsPrec :: Int -> FlagAssignment -> ShowS # show :: FlagAssignment -> String # showList :: [FlagAssignment] -> ShowS # | |||||
Eq FlagAssignment Source # | |||||
Defined in Distribution.Types.Flag (==) :: FlagAssignment -> FlagAssignment -> Bool # (/=) :: FlagAssignment -> FlagAssignment -> Bool # | |||||
Ord FlagAssignment Source # | |||||
Defined in Distribution.Types.Flag compare :: FlagAssignment -> FlagAssignment -> Ordering # (<) :: FlagAssignment -> FlagAssignment -> Bool # (<=) :: FlagAssignment -> FlagAssignment -> Bool # (>) :: FlagAssignment -> FlagAssignment -> Bool # (>=) :: FlagAssignment -> FlagAssignment -> Bool # max :: FlagAssignment -> FlagAssignment -> FlagAssignment # min :: FlagAssignment -> FlagAssignment -> FlagAssignment # | |||||
type Rep FlagAssignment Source # | |||||
Defined in Distribution.Types.Flag type Rep FlagAssignment = D1 ('MetaData "FlagAssignment" "Distribution.Types.Flag" "Cabal-syntax-3.11.0.0-97f9" 'True) (C1 ('MetaCons "FlagAssignment" 'PrefixI 'True) (S1 ('MetaSel ('Just "getFlagAssignment") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map FlagName (Int, Bool))))) |
mkFlagAssignment :: [(FlagName, Bool)] -> FlagAssignment Source #
Construct a FlagAssignment
from a list of flag/value pairs.
If duplicate flags occur in the input list, the later entries in the list will take precedence.
Since: Cabal-syntax-2.2.0
unFlagAssignment :: FlagAssignment -> [(FlagName, Bool)] Source #
Deconstruct a FlagAssignment
into a list of flag/value pairs.
null
(findDuplicateFlagAssignments
fa) ==> (mkFlagAssignment
.unFlagAssignment
) fa == fa
Since: Cabal-syntax-2.2.0
lookupFlagAssignment :: FlagName -> FlagAssignment -> Maybe Bool Source #
Lookup the value for a flag
Returns Nothing
if the flag isn't contained in the FlagAssignment
.
Since: Cabal-syntax-2.2.0
insertFlagAssignment :: FlagName -> Bool -> FlagAssignment -> FlagAssignment Source #
Insert or update the boolean value of a flag.
If the flag is already present in the FlagAssignment
, the
value will be updated and the fact that multiple values have
been provided for that flag will be recorded so that a
warning can be generated later on.
Since: Cabal-syntax-2.2.0
diffFlagAssignment :: FlagAssignment -> FlagAssignment -> FlagAssignment Source #
Remove all flag-assignments from the first FlagAssignment
that
are contained in the second FlagAssignment
NB/TODO: This currently only removes flag assignments which also match the value assignment! We should review the code which uses this operation to figure out if this it's not enough to only compare the flagnames without the values.
Since: Cabal-syntax-2.2.0
findDuplicateFlagAssignments :: FlagAssignment -> [FlagName] Source #
Find the FlagName
s that have been listed more than once.
Since: Cabal-syntax-2.2.0
nullFlagAssignment :: FlagAssignment -> Bool Source #
Test whether FlagAssignment
is empty.
Since: Cabal-syntax-2.2.0
dispFlagAssignment :: FlagAssignment -> Doc Source #
Pretty-prints a flag assignment.
showFlagAssignment :: FlagAssignment -> String Source #
Show flag assignment.
Since: Cabal-syntax-3.4.0.0
parsecFlagAssignment :: CabalParsing m => m FlagAssignment Source #
Parses a flag assignment.
parsecFlagAssignmentNonEmpty :: CabalParsing m => m FlagAssignment Source #
Parse a non-empty flag assignment
The flags have to explicitly start with minus or plus.
Since: Cabal-syntax-3.4.0.0
Legacy formats
legacyShowFlagAssignment :: FlagAssignment -> String Source #
We need this as far as we support custom setups older than 2.2.0.0
Since: Cabal-syntax-3.4.0.0
legacyShowFlagAssignment' :: FlagAssignment -> [String] Source #
Since: Cabal-syntax-3.4.0.0
legacyParsecFlagAssignment :: CabalParsing m => m FlagAssignment Source #
We need this as far as we support custom setups older than 2.2.0.0
Since: Cabal-syntax-3.4.0.0