Content deleted Content added
→Writer monad (JavaScript): Appending => Concatenating to match code example |
m →An example: Maybe: fix comma splice |
||
Line 43:
</syntaxhighlight>
<code>Maybe<T></code> can also be understood as a "wrapping" type, and this is where its connection to monads comes in. In languages with some form of the <code>Maybe</code> type, there are functions that aid in their use such as composing '''monadic functions''' with each other and testing if a <code>Maybe</code> contains a value.
In the following hard-coded example, a <code>Maybe</code> type is used as a result of functions that may fail, in this case the type returns nothing if there is a [[divide-by-zero]].<syntaxhighlight lang="rust">
|