monad-laws | R Documentation |
Classes implementing bind()
are expected to satisfy three monad laws: left
identity, right identity, and associativity.
pure |
The function to wrap a value in the monad. |
h , g |
Monadic functions. Functions that return monadic objects. |
a |
Any object. |
m |
A monadic object. |
The Haskell monad laws can be translated into R as follows:
pure(a) %>-% h
is equal to h(a)
.
m %>-% pure
is equal to m
.
(m %>-% g) %>-% h
is equal to m %>-% \(x) g(x) %>-% h
.
https://wiki.haskell.org/Monad_laws
Other implementation laws:
functor-laws
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.