liveBook · Manning

Monad stack

A monad stack is a nested composition of monads or monad transformers that combines multiple computational effects behind a monadic interface.

How 2 Manning books explain it

Functional Design and Architecture: Examples in Haskell

A monad stack is a composition of nested monads that presents their combined effects through one monadic interface.

How it is used
Combines state, IO, environments, and error handling in stateful scripts and web handlers.
How deep it goes
Explains transformer nesting, repeated lifting, layer-by-layer execution, and the simplicity trade-off of combining state.
Examples
Uses Minesweeper board and score scripts, state-stack tests, and a Servant business-logic handler.
What you can do after
Apply it via Haskell's StateT to combine state with IO, lift inner actions, and run the resulting layers.

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

Functional Programming in C#, Second Edition

A monad stack is a composition of multiple monadic effects represented by nested monadic types.

How it is used
Combines asynchronous effects, optional account lookup, and validation in a transfer-request workflow.
How deep it goes
Explains nested-type mismatches, adapters, and Traverse, but omits the stack-specific query-pattern implementation.
Examples
Uses a MakeTransfer endpoint with validation, account retrieval, debit, and event publishing.
What you can do after
Apply LINQ query syntax to compose Task<Validation<T>> operations, adapting Validation<T> and Task<T> values as needed.

Read how Functional Programming in C#, Second Edition explains monad stack →

Also covered in

What to know first

Related concepts

Questions about monad stack

What is monad stack?

A monad stack is a nested composition of monads or monad transformers that combines multiple computational effects behind a monadic interface.

Which Manning books explain monad stack?

Functional Design and Architecture: Examples in Haskell and Functional Programming in C#, Second Edition.

What should I know before learning monad stack?

Manning books that teach monad stack usually introduce state, IO, monad and monad transformer first.

What are the parts of monad stack?

Monad stack includes ExceptT, IO and monad transformer.

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.