| Maybe | R Documentation |
The maybe package implements the Maybe
monad. It represents the explicit possiblity of absence of a value.
Methods for fmap(), bind() and join() are provided for the maybe
S3 class as wrappers to functions in the package.
maybe::maybe_map() which implements fmap() for maybe.
maybe::and_then() which implements bind() for maybe.
Other monads:
List
# The fmap operator corresponds to maybe::maybe_map().
maybe::just(1) %>>% `+`(1)
maybe::nothing() %>>% `+`(1)
# The bind operator corresponds to maybe::and_then().
maybe::just(1) %>-% \(x) maybe::just(x + 1)
maybe::just(1) %>-% \(x) maybe::nothing()
maybe::nothing() %>-% \(x) maybe::just(1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.