promise_resolve: Create a resolved or rejected promise

Description Usage Arguments Examples

View source: R/promise.R

Description

Helper functions to conveniently create a promise that is resolved to the given value (or rejected with the given reason).

Usage

1
2
3

Arguments

value

A value, or promise, that the new promise should be resolved to. This expression will be lazily evaluated, and if evaluating the expression raises an error, then the new promise will be rejected with that error as the reason.

reason

An error message string, or error object.

Examples

1
2
3
4
5
6
promise_resolve(mtcars) %...>%
  head() %...>%
  print()

promise_reject("Something went wrong") %...T!%
  { message(conditionMessage(.)) }

promises documentation built on Feb. 12, 2021, 1:06 a.m.