resA or resB.
const success = ok<number>(2);
const failure = err<string>("not a 2");
const lateError = err<string>("late error");
const earlyError = err<string>("early error");
const anotherSuccess = ok<number>(100);
expect(or<string, number>(lateError)(success)).toStrictEqual(success);
expect(or<string, number>(success)(earlyError)).toStrictEqual(success);
expect(or(lateError)(failure)).toStrictEqual(lateError);
expect(or(anotherSuccess)(success)).toStrictEqual(success);
Returns
resBifresAis anErr, otherwise returns the successresA. The order of arguments is reversed because of that it is useful for partial applying.