concept State in category functional programming
appears as: State

This is an excerpt from Manning's book Functional Programming with Kotlin.
It is worth noting that this style of for-comprehension will not work with our
Optiontype, as the supported classes need to be instances of Arrow’sMonadtype class. We will learn about Monads and type classes later in the book, but for now suffice to say that this will only work with Arrow’s supported types such asOption,Either,List,StateandIOto mention but a few.
Listing 6.22. Generalized
Statetype alias for state transitiontypealias State<S, A> = (S) -> Pair<A, S>Here
Stateis short for computation that carries some state along, or state action, state transition, or even statement (see section 6.6). We might want to write it as its own class, wrapping the underlying function and naming itrun.