We would need to define our own Semigroup for the left/right types, and possibly pick a different underlying Xor (I believe there's at least 2 different implementations in cats) to get the combining behavior we want (left+right = left or right). What I really want is
Which is probably impossible with the above signature, but maybe we can add our own version?
Actually, what I really want is a non-exclusiveOutcome that contains 0-n successes and 0-n failures and is right-biased but doesn't discard left so you can pipe around the success/failure state and recover/collect as needed, and also has .isAllRight type methods. Does this exist somewhere? @bigs
We encounter a lot of situations where the types look like
Xor[List[Xor[Thing]]]
which is a real pain to unpack, especially since the
toList
trick, which sort of works withOption
semantics, does not preserveleft
s.Xor
provides acombine
method:This allows Xors to be combined:
We would need to define our own
Semigroup
for the left/right types, and possibly pick a different underlyingXor
(I believe there's at least 2 different implementations in cats) to get the combining behavior we want (left+right = left or right). What I really want isWhich is probably impossible with the above signature, but maybe we can add our own version?
Actually, what I really want is a non-exclusive
Outcome
that contains 0-n successes and 0-n failures and isright
-biased but doesn't discardleft
so you can pipe around the success/failure state and recover/collect as needed, and also has.isAllRight
type methods. Does this exist somewhere? @bigs