Promise-aware pipe operators, in the style of magrittr.
Like magrittr pipes, these operators can be used to chain together pipelines
of promise-transforming operations. Unlike magrittr pipes, these pipes wait
for promise resolution and pass the unwrapped value (or error) to the
1 2 3 4 5 6 7
lhs %...>% rhs lhs %...T>% rhs lhs %...!% rhs lhs %...T!% rhs
A promise object.
A function call using the magrittr semantics. It can return either a promise or non-promise value, or throw an error.
> variants are for handling successful resolution, the
! variants are
for handling errors. The
T variants of each return the lhs instead of the
rhs, which is useful for pipeline steps that are used for side effects
(printing, plotting, saving).
promise %...>% func() is equivalent to
promise %>% then(func).
promise %...!% func() is equivalent to
promise %>% catch(func).
promise %...T>% func() is equivalent to
promise %T>% then(func).
promise %...T!% func() is equivalent to
promise %>% catch(func, tee = TRUE).
One situation where 3. and 4. above break down is when
func() throws an
error, or returns a promise that ultimately fails. In that case, the failure
will be propagated by our pipe operators but not by the
For simplicity of implementation, we do not support the magrittr feature of
. at the head of a pipeline to turn the entire pipeline into a
function instead of an expression.
A new promise.
1 2 3 4 5 6 7 8 9 10 11 12 13
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.