Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

promise_resolve

Create a resolved or rejected promise


Description

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

Usage

promise_resolve(value)

promise_reject(reason)

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

promise_resolve(mtcars) %...>%
  head() %...>%
  print()

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

promises

Abstractions for Promise-Based Asynchronous Programming

v1.2.0.1
MIT + file LICENSE
Authors
Joe Cheng [aut, cre], RStudio [cph, fnd]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.