Monad
A monad is a functional abstraction that encapsulates computational context and provides operations for composing computations while preserving that context.
Functional Programming in Scala, Second Edition
A monad is an abstraction that represents effectful or context-dependent values and provides operations, including flatMap, for sequencing computations while preserving that context.
- How it is used
- Factors repeated sequencing logic across contextual computation types into one reusable interface.
- How deep it goes
- Defines minimal primitives and laws, derives combinators, and works through State, Option, Parser, and IO applications.
- Examples
- Uses duplicate `map2` implementations, generated orders, dependent map lookups, dynamic CSV parsing, state indexing, and console I/O.
- What you can do after
- Build it from scratch by defining `unit` and `flatMap`, deriving combinators, and checking associativity and identity laws.
Read how Functional Programming in Scala, Second Edition explains monad →
The Joy of JavaScript
An abstraction for sequencing computations through a context that can carry values and effects while supporting composition via flatMap-like chaining.
- How it is used
- Sequences container-returning functions while letting Validation stop later checks after a failure.
- How deep it goes
- Defines the map and flatMap contracts, demonstrates three laws, and builds chaining and composeM; defers extensive algebraic theory.
- Examples
- Works through Id and array chains, block-validation checks, blockchain traversal, and Promise.then flattening.
- What you can do after
- Build it from scratch with JavaScript mixins and composeM to chain Validation-returning checks.
Functional Programming in JavaScript
An abstraction that represents computations with context and provides a way to sequence them while controlling how values and effects propagate.
- How it is used
- Orchestrates safe data flow through functional pipelines handling missing values, failures, and delayed effects.
- How deep it goes
- Explains Wrapper, Maybe, Either, and IO implementations, then demonstrates map, join, chain, composition, and execution without category theory.
- Examples
- Uses student lookup and address access, even-number halving, URI decoding, DOM updates, and a student-information display pipeline.
- What you can do after
- Apply it via JavaScript container types to compose validation, lookup, error handling, and DOM effects while safely propagating failure.
Read how Functional Programming in JavaScript explains monad →
Learn Haskell by Example
A monad is an abstraction that sequences computations while encapsulating a computational context.
- How it is used
- Enables parsers to choose later parsing steps from earlier results and handle failures through composition.
- How deep it goes
- Defines Monad operations, demonstrates Maybe and do notation, and implements a Monad instance for a custom parser.
- Examples
- Uses Maybe calculations, monadic addition, a Hello World parser, integer parsing, and conditional PNM headers.
- What you can do after
- Build it from scratch by defining bind behavior for a parser and using do notation for dependent parsing.
Fabulous Adventures in Data Structures and Algorithms
A monad is an abstraction that pairs a type with operations for lifting values and chaining context-aware computations while preserving the structure of composition.
- How it is used
- Structures workflows that carry capabilities such as nullability, laziness, asynchrony, observation, or sequencing.
- How deep it goes
- Develops Unit, Map, Bind, and Join with C# transformations, but stops short of spelling out the monad laws.
- Examples
- Uses Nullable<T>, Lazy<T>, Task<T>, IEnumerable<T>, division by two, nested lazy values, and discrete distributions.
- What you can do after
- Apply it via Unit and Bind to transform ordinary workflows into workflows carrying nullable, lazy, asynchronous, sequence, or probabilistic behavior.
Read how Fabulous Adventures in Data Structures and Algorithms explains monad →
Functional Design and Architecture: Examples in Haskell
A monad is an abstraction that sequences computations while encapsulating a computational context such as optionality, state, errors, or input-output effects.
- How it is used
- Sequences effectful computations while keeping optionality, state, errors, and input-output concerns explicit.
- How deep it goes
- Defines monads through contexts and examples, then applies Maybe sequencing, while deferring deeper study to monad transformers and extended examples.
- Examples
- Uses Maybe-based user lookups, nested case expressions, do notation, and free monadic domain-specific scripting.
- What you can do after
- Apply monadic sequencing to simplify computations that carry failure or other computational effects.
Read how Functional Design and Architecture: Examples in Haskell explains monad →
Related concepts
- flatmapuses · FlatMap is an operation that applies a function producing nested collections or computational contexts to each element and combines the resulting contexts into one flattened result.
- applicative functorcontrasts with · An applicative functor is an abstraction that applies functions within a computational context to context-wrapped values while combining their contexts.
- functorkind of · A functor is an abstraction that maps values or objects while preserving the structure and relationships of their surrounding context.
- type-lifting functionuses · A type-lifting function embeds a value into a corresponding computational context, container, or type, often a monadic type.
- associativityuses · Associativity is the property of a binary operation that regrouping its operands does not change the result.
- Haskellused by · Haskell is a statically typed, purely functional programming language with non-strict, typically lazy evaluation.
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.





