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. condTreeConstraints records
the constraints (in this case, ConfVar
[Dependency] BuildInfobase >= 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 :: acondTreeConstraints :: ccondTreeComponents :: [CondBranch v c a]
Instances13Functor, Foldable, Traversable, Eq, Data, Show, …
Functor (CondTree v c)Defined in Cabal-syntax-3.12.1.0 · Distribution.Types.CondTreeFoldable (CondTree v c)Defined in Cabal-syntax-3.12.1.0 · Distribution.Types.CondTreeTraversable (CondTree v c)Defined in Cabal-syntax-3.12.1.0 · Distribution.Types.CondTree(Eq a, Eq c, Eq v) => Eq (CondTree v c a)Defined in Cabal-syntax-3.12.1.0 · Distribution.Types.CondTree(Data v, Data a, Data c) => Data (CondTree v c a)Defined in Cabal-syntax-3.12.1.0 · Distribution.Types.CondTree(Show a, Show c, Show v) => Show (CondTree v c a)Defined in Cabal-syntax-3.12.1.0 · Distribution.Types.CondTreeGeneric (CondTree v c a)Defined in Cabal-syntax-3.12.1.0 · Distribution.Types.CondTree(Semigroup a, Semigroup c) => Semigroup (CondTree v c a)Defined in Cabal-syntax-3.12.1.0 · Distribution.Types.CondTree(Semigroup a, Semigroup c, Monoid a, Monoid c) => Monoid (CondTree v c a)Defined in Cabal-syntax-3.12.1.0 · Distribution.Types.CondTree(NFData v, NFData c, NFData a) => NFData (CondTree v c a)Defined in Cabal-syntax-3.12.1.0 · Distribution.Types.CondTree(Binary v, Binary c, Binary a) => Binary (CondTree v c a)Defined in Cabal-syntax-3.12.1.0 · Distribution.Types.CondTree(Structured v, Structured c, Structured a) => Structured (CondTree v c a)Defined in Cabal-syntax-3.12.1.0 · Distribution.Types.CondTreetype Rep (CondTree v c a) = D1 ('MetaDataDefined in Cabal-syntax-3.12.1.0 · Distribution.Types.CondTree"CondTree"
"Distribution.Types.CondTree"
"Cabal-syntax-3.12.1.0-3adc"
'False) (C1 ('MetaCons"CondNode"
'PrefixI 'True) (S1 ('MetaSel ('Just"condTreeData"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: (S1 ('MetaSel ('Just"condTreeConstraints"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 c) :*: S1 ('MetaSel ('Just"condTreeComponents"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [CondBranch v c a]))))