Given a function which takes no arguments and returns a Promise, return a
Task<T, unknown> for the result of invoking that function.
This safely handles functions which fail synchronously or asynchronously, so
unlike Task.try is safe to use with values which may throw errors
before producing a Promise.
Given a function which takes no arguments and returns a
Promise
, return aTask<T, unknown>
for the result of invoking that function. This safely handles functions which fail synchronously or asynchronously, so unlikeTask.try
is safe to use with values which may throw errors before producing aPromise
.Examples