//Plus on VoidResult<TError> public static VoidResult <TError> Plus <TError>(this VoidResult <TError> left, VoidResult <TError> right, Func <TError, TError, TError> mergeFunc) => left.Match( leftValue => right.Match( rightValue => Ok <TError>(), Fail ), error => right.Match( rightValue => Fail(error), otherError => Fail(mergeFunc.ThrowIfDefault(nameof(mergeFunc))(error, otherError)) ) );
//Flatten on VoidResult<TError> public static VoidResult <TError> Flatten <TError>(this VoidResult <VoidResult <TError> > value) => value.Match(_ => Ok <TError>(), Id);
//Plus on VoidResult public static VoidResult Plus(this VoidResult left, VoidResult right) => left.Match( leftValue => right.Match(_ => Ok(), Fail), error => right.Match(rightValue => Fail(error), otherError => Fail(error.Concat(otherError))) );
public static VoidResult <TError> Plus <TError>(this VoidResult <TError> left, VoidResult <TError> right) where TError : IPlus <TError, TError> => left.Plus(right, (leftError, rightError) => leftError.Plus(rightError));