runState executes a stateful computation from an initial state and returns both the computation’s result and its final state. For a Haskell State value, provide the script and starting state; the function runs the state transitions rather than requiring explicit state arguments. section 7.2.2
runState :: State state returnValue -> state -> (state, returnValue)
The type signature shows runState consuming a State computation and an initial state, then producing the final state together with the return value. section 7.2.2
Running an age script
Running bornAndGettingOlderTwice with initial age 111 yields two messages and a final age of 2. A test checks both the returned messages and the resulting state. section 7.2.2
