Description Usage Arguments Details Examples
To make a class a monad, you need to define three generics: fmap
,
bind
, and join
. fmap
takes a non-monad function,
and applies it to a monad by unwrapping, applying, and rewrapping.
bind
apply a function that takes a regular value and returns a monad,
by unwrapping and applying. join
collapses a monad that's nested
inside itself.
1 2 3 4 5 |
.m |
The monad |
.f |
A function, formula, or atomic vector. If a function, it is used as is. If a formula, e.g. If character or integer vector, e.g. |
... |
Additonal arguments passed on to |
Any object with a fmap
method is called a functor
.
1 2 3 4 5 6 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.