merge<M, J> method
Performs a merge operation and returns a new instance of M.
Implementation
Result<M, E> merge<M, J>(Result<J, E> other, M Function(T, J) onJoin) =>
match(
onSuccess: (firstValue) => other.match(
onSuccess: (secondValue) =>
Success<M, E>(onJoin(firstValue, secondValue)),
onError: Error<M, E>.new,
),
onError: (firstError) => other.match(
onSuccess: (_) => Error<M, E>(firstError),
onError: (_) => Error<M, E>(firstError),
),
);