-- | Helper function that tries to enforce a single package constraint on a
-- given flag setting for an F-node. Translates the constraint into a
-- tree-transformer that either leaves the subtree untouched, or replaces it
-- with an appropriate failure node.
processPackageConstraintS :: OptionalStanza -> ConflictSet QPN -> Bool -> PackageConstraint -> Tree a -> Tree a
processPackageConstraintS s c b' (PackageConstraintStanzas _ ss) r =
  if not b' && s `elem` ss then Fail c GlobalConstraintFlag
                           else r
processPackageConstraintS :: OptionalStanza -> ConflictSet QPN -> Bool -> PackageConstraint -> Tree a -> Tree a
processPackageConstraintS s c b' (PackageConstraintStanzas _ ss) r =
  if not b' && s `elem` ss then Fail c GlobalConstraintFlag
                           else r
processPackageConstraintS s c b' (PackageConstraintStanzas _ ss) r =
  if not b' && s `elem` ss then Fail c GlobalConstraintFlag
                           else r