-- | Helper function that tries to enforce a single package constraint on a
-- given instance for a P-node. Translates the constraint into a
-- tree-transformer that either leaves the subtree untouched, or replaces it
-- with an appropriate failure node.
processPackageConstraintP :: ConflictSet QPN -> I -> PackageConstraint -> Tree a -> Tree a
processPackageConstraintP c (I v _) (PackageConstraintVersion _ vr) r
  | checkVR vr v  = r
  | otherwise     = Fail c (GlobalConstraintVersion vr)
processPackageConstraintP :: ConflictSet QPN -> I -> PackageConstraint -> Tree a -> Tree a
processPackageConstraintP c (I v _) (PackageConstraintVersion _ vr) r
  | checkVR vr v  = r
  | otherwise     = Fail c (GlobalConstraintVersion vr)
processPackageConstraintP c (I v _) (PackageConstraintVersion _ vr) r
  | checkVR vr v  = r
  | otherwise     = Fail c (GlobalConstraintVersion vr)