Monoid instance for CondTree
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
When experimenting with the Cabal solver, I've defined the following orphan `Monoid` instance:
``` haskell
instance (Monoid c, Monoid a) => Monoid (CondTree v c a) where
mempty = CondNode mempty mempty mempty
mappend cn1 cn2 =
CondNode { condTreeData = mappend (condTreeData cn1) (condTreeData cn2)
, condTreeConstraints = mappend (condTreeConstraints cn1) (condTreeConstraints cn2)
, condTreeComponents = mappend (condTreeComponents cn1) (condTreeComponents cn2)
}
mconcat cns =
CondNode { condTreeData = mconcat (map condTreeData cns)
, condTreeConstraints = mconcat (map condTreeConstraints cns)
, condTreeComponents = mconcat (map condTreeComponents cns)
}
```
Does this instance make sense to be added to `Cabal`?
/cc @kosmikus
Contributor guide
Research direction
Start by locating the CondTree definition and reviewing its existing instances and uses in the Cabal solver. Determine whether combining data, constraints, and components with Monoid laws is intended, then document the decision; if accepted, add the instance and tests covering the stated behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100