September 2017
Beginner to intermediate
396 pages
9h 46m
English
A State Monad is a function that takes a state s and produces an output (a, s). Here, a is the result of monadic computation, and in all monad steps, the state s is threaded through each step. This is illustrated in the following diagram:

During the monadic bind operations, the result of the previous operation is taken and is fed into a function that produces the next output, as shown in the preceding diagram.
It is important to note two specific operations that are defined in the context of the State Monad. These operations are get and put, used for getting the current state and saving a new state, respectively.
In the ...
Read now
Unlock full access