Attaches callbacks for the resolution and/or rejection of the Promise.
Optionalonfulfilled: ((value: Either) => TResult1 | PromiseLike<TResult1>) | nullThe callback to execute when the Promise is resolved.
Optionalonrejected: ((reason: any) => TResult2 | PromiseLike<TResult2>) | nullThe callback to execute when the Promise is rejected.
A Promise for the completion of which ever callback is executed.
Returns the first Right between the future value of this and another EitherAsync or the Left in the argument if both this and the argument resolve to Left
Structural pattern matching for EitherAsync in the form of a function
Returns this if it resolves to a Left, otherwise it returns the result of applying the function argument to this and wrapping it in a Right
Runs an effect if this is Left, returns this to make chaining other methods possible
Runs an effect if this is Right, returns this to make chaining other methods possible
Flattens an Either nested inside an EitherAsync. e.join() is equivalent to e.chain(async x => x)
Transforms the Right value of this with a given function. If the EitherAsync that is being mapped resolves to a Left then the mapping function won't be called and run will resolve the whole thing to that Left, just like the regular Either#map
Maps the Left value of this, acts like an identity if this is Right
It's important to remember how run will behave because in an
async context there are other ways for a function to fail other
than to return a Nothing, for example:
If any of the computations inside EitherAsync resolved to a Left,
run will return a Promise resolved to that Left.
If any of the promises were to be rejected then run will return
a Promise resolved to a Left with the rejection value inside
If an exception is thrown then run will return a Promise
resolved to a Left with the exception inside
If none of the above happen then a promise resolved to the
returned value wrapped in a Right will be returned
Returns Right if this is Left and vice versa
Converts this to a MaybeAsync, discarding any error values
Useful if you are not interested in the result of an operation
WARNING: This is implemented only for Promise compatibility. Please use
chaininstead.