and_then {maybe} | R Documentation |
Evaluate a maybe returning function on a maybe value
Description
Evaluate a maybe returning function on a maybe value
Usage
and_then(.m, .f, ...)
bind(.m, .f, ...)
Arguments
.m |
A maybe value |
.f |
A maybe returning function to apply to the maybe value |
... |
Named arguments for the function |
Value
A maybe value
Examples
safe_sqrt <- maybe(sqrt, ensure = not_infinite)
just(9) %>% and_then(safe_sqrt)
just(-1) %>% and_then(safe_sqrt)
nothing() %>% and_then(safe_sqrt)
[Package maybe version 1.1.0 Index]