Creating Results
Now that you understand the Result type, let's learn how to create them using the library's helper functions.
Creating Success Results with succeed
The succeed function creates a Success result:
With Async Values
succeed does not automatically await a Promise. Await the value yourself before passing it in:
Creating Failure Results with fail
The fail function creates a Failure result:
With Async Errors
Like succeed, fail does not automatically await a Promise. Await the error yourself before passing it in:
Starting a Pipeline with do
The do function is a convenient way to start a pipeline with an empty object:
This is especially useful when building up an object step by step (we'll cover this pattern with bind in a later section):
