Closed julien-truffaut closed 2 years ago
Some thoughts on this, it feels like we're using different instances of Monoid
for each of the traverses.
permissive
is essentially similar to the or
, with a last
for the error.strict
is essentially an and
, with the first
for the erroraccumulation
is essentially an or
with concat
for the error.The simplest way (and probably best to limit the API scope) is to have a field on the traverse which abstract over it. Then users can do traverse.withCombine(Combine.strict/accum/permissive)
.
A final note, is that this helps, because then the returned type can be different as well.
Now that we offer custom errors for
Traversal
, we should also offer ways to composeTraversal
:Prism.below
)A typical scenario would be: