Attaches callbacks for the resolution and/or rejection of the Promise.
A Promise for the completion of which ever callback is executed.
Returns the first Just between the future value of this and another future Maybe or future Nothing if both this and the argument are Nothing
Maps the future value of this with another future Maybe function
Structural pattern matching for MaybeAsync in the form of a function
Transforms this with a function that returns a MaybeAsync. Behaviour is the same as the regular Maybe#chain
Returns this if it resolves to Nothing, otherwise it returns the result of applying the function argument to the value of this and wrapping it in a Just
Takes a predicate function and returns this if the predicate, applied to the resolved value, is true or Nothing if it's false
Takes a predicate function and returns this if the predicate, applied to the resolved value, is true or Nothing if it's false
Runs an effect if this is Just, returns this to make chaining other methods possible
Runs an effect if this is Nothing, returns this to make chaining other methods possible
Flattens a Maybe nested inside a MaybeAsync. m.join() is equivalent to m.chain(async x => x)
Transforms the value inside this with a given function. If the MaybeAsync that is being mapped resolves to Nothing then the mapping function won't be called and run will resolve the whole thing to Nothing, just like the regular Maybe#map
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 MaybeAsync resolved to Nothing,
run will return a Promise resolved to Nothing.
If any of the promises were to be rejected then run will return
a Promise resolved to Nothing.
If an exception is thrown then run will return a Promise
resolved to Nothing.
If none of the above happen then a promise resolved to the
returned value wrapped in a Just will be returned.
Converts this to a EitherAsync with a default error value
Useful if you are not interested in the result of an operation
WARNING: This is implemented only for Promise compatibility. Please use
chaininstead.