Consolidate Scala library
This library offers consolidate of immutable data, through the
Merge[A] typeclass (which can be autoderived with optional validation) and the
Result[A] result type.
After merging a current piece of data (
lhs) with a new piece
lhs merge rhs, the result is:
rhsdoes not offer additional information,
rhshas new information, with
mthe merged result and
updatesis a non-empty list of changes,
rhsare incompatible, and
errorsis a non-empty list of errors.
Merge[A] is an
ApplicativeError, which accumulates updates and errors.
The default Merge typeclass implementation is
Merge.fromEquals, that compares
rhs and returns
lhs == rhs and
Implementation are provided for
Map[String, V] (by completing the map entries, and merging the values when both
rhs provide a key),
Option (by taking the
Some entry, and merging both
Some when applicable),
Set (by taking the union of sets).