infix: Infix fmap and bind.

Description Usage Arguments Examples

Description

This works like magrittr's %>%, but uses fmap to unwrap, apply, and then rewrap the object.

Usage

1
2
3
lhs %>>% rhs

lhs %>+% rhs

Arguments

lhs

A monad

rhs

Call to invoke.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
if (require("shiny")) {
options(shiny.suppressMissingContextError = TRUE)
r <- reactive(iris)
r2 <- r %>>% head(5)
r2()

double <- function(x) x * 2
maybe(10) %>>% double
maybe(10) %>>% double()
maybe(10) %>>% function(x) x * 2
}

hadley/monads documentation built on May 17, 2019, 11:03 a.m.