bind: Apply f to the contents of a monad and merge messages

Description Usage Arguments Value

View source: R/bind.R

Description

This function should not be used directly. Rather you should use the infix operators. They all wrap this function.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
bind(
  x,
  f,
  entry_lhs_transform = entry_lhs_transform_default,
  bind_if = function(m) .single_OK(m),
  bind_else = default_bind_else,
  emit = emit_default,
  m_on_bind = function(x, ...) {     x },
  io_combine = default_combine,
  bind_args = function(m) list(.single_value(m, warn = FALSE)),
  parent_ids = function(m) list(.get_ids(m)[.single_id(m)]),
  expect_rhs_function = TRUE,
  envir = parent.frame()
)

Arguments

x

The input, may or may not be a monad report

f

A function of the value contained in x

entry_lhs_transform

f(m,x,...) a transform of the lhs called on entry

bind_if

f(m) bind rhs to lhs if TRUE

bind_else

f(m,f) action to take if bind_if is FALSE

emit

f(i,o) Emit the input or the output

io_combine

f(m,o) weave m and f(m) into final output

bind_args

function to retrieve the arguments

.single_on_bind

f(m) Action to perform on input monad when binding

Value

A monad report


arendsee/monadR documentation built on Dec. 16, 2020, 4:26 a.m.