A CondTree is used to represent the conditional structure of
a Cabal file, reflecting a syntax element subject to constraints,
and then any number of sub-elements which may be enabled subject
to some condition. Both a and c are usually Monoids.
To be more concrete, consider the following fragment of a Cabal
file:
build-depends: base >= 4.0
if flag(extra)
build-depends: base >= 4.2
One way to represent this is to have CondTree . Here, condTreeData represents
the actual fields which are not behind any conditional, while
condTreeComponents recursively records any further fields
which are behind a conditional. ConfVar
[Dependency] BuildInfocondTreeConstraints records
the constraints (in this case, base >= 4.0) which would
be applied if you use this syntax; in general, this is
derived off of targetBuildInfo (perhaps a good refactoring
would be to convert this into an opaque type, with a smart
constructor that pre-computes the dependencies.)
Constructors
CondNodecondTreeData :: acondTreeComponents :: [CondBranch v a]
Instances13Functor, Foldable, Traversable, Eq, Data, Show, …
Functor (CondTree v)Defined in Cabal-syntax-3.18.1.0 · Distribution.Types.CondTreeFoldable (CondTree v)Defined in Cabal-syntax-3.18.1.0 · Distribution.Types.CondTreeTraversable (CondTree v)Defined in Cabal-syntax-3.18.1.0 · Distribution.Types.CondTree(Eq a, Eq v) => Eq (CondTree v a)Defined in Cabal-syntax-3.18.1.0 · Distribution.Types.CondTree(Data v, Data a) => Data (CondTree v a)Defined in Cabal-syntax-3.18.1.0 · Distribution.Types.CondTree(Show a, Show v) => Show (CondTree v a)Defined in Cabal-syntax-3.18.1.0 · Distribution.Types.CondTreeGeneric (CondTree v a)Defined in Cabal-syntax-3.18.1.0 · Distribution.Types.CondTreeSemigroup a => Semigroup (CondTree v a)Defined in Cabal-syntax-3.18.1.0 · Distribution.Types.CondTreeMonoid a => Monoid (CondTree v a)Defined in Cabal-syntax-3.18.1.0 · Distribution.Types.CondTree(NFData v, NFData a) => NFData (CondTree v a)Defined in Cabal-syntax-3.18.1.0 · Distribution.Types.CondTree(Binary v, Binary a) => Binary (CondTree v a)Defined in Cabal-syntax-3.18.1.0 · Distribution.Types.CondTree(Structured v, Structured a) => Structured (CondTree v a)Defined in Cabal-syntax-3.18.1.0 · Distribution.Types.CondTreetype Rep (CondTree v a) = D1 ('MetaDataDefined in Cabal-syntax-3.18.1.0 · Distribution.Types.CondTree"CondTree"
"Distribution.Types.CondTree"
"Cabal-syntax-3.18.1.0-a008"
'False) (C1 ('MetaCons"CondNode"
'PrefixI 'True) (S1 ('MetaSel ('Just"condTreeData"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Just"condTreeComponents"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [CondBranch v a])))