liveBook · Manning

StateT

StateT is a Haskell monad transformer that threads and updates state through computations in an underlying monad.

How 2 Manning books explain it

Functional Design and Architecture: Examples in Haskell

StateT is a Haskell monad transformer that adds a mutable-state abstraction to an underlying monadic computation.

How it is used
Structures stateful game and ship-control scripts while retaining IO or domain-specific monadic actions.
How deep it goes
Explains types, get, put, lift, nested stacks, runners, and tests; defers transformer foundations to appendixes.
Examples
Uses aging scripts, a Minesweeper board reveal, layered score-and-board state, tests, and spaceship rotation control.
What you can do after
Build stateful scripts over IO or a custom monad, lift inner actions, run stack layers, and test final state.

Read how Functional Design and Architecture: Examples in Haskell explains StateT →

Learn Haskell by Example

StateT is a Haskell monad transformer that threads and updates state through computations in an underlying monad.

How it is used
Threads mutable application data through computations that also perform effects such as filesystem IO.
How deep it goes
Defines the type parameters and three essential operations, then demonstrates recursive state updates while deferring less-used functions.
Examples
Uses recursive directory traversal, counters, a Stats record, modify helpers, execStateT, and GHCi execution.
What you can do after
Apply it via Control.Monad.Trans.State.Strict to build effectful computations that read, replace, and update threaded state.

Read how Learn Haskell by Example explains StateT →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.