Function fromPromise

  • Lift from promise to task resolving to that promise result

    Userfull for converting promises to tasks If converted task is canceled or failed externally return value will be ignored without side-effects All tasks are no-trowing by default, any occured errors are returned as Left

    Type Parameters

    • R

      returned task resolve type

    Parameters

    • promise: PromiseLike<R>

      promise to be resolved

    Returns Task<R>

    task resolving to specified promise value

    Example

    const task = Task.fromPromise(someAsyncOperation('someData')).map((result) => result.length);
    

Generated using TypeDoc