Do notation
Do notation is Haskell syntax for sequencing monadic computations and binding their intermediate results in a readable, imperative-like form.
Learn Haskell by Example
Do notation, or a do block, is Haskell syntax for sequencing monadic computations and binding their intermediate results.
- How it is used
- Sequences IO and parser actions while passing produced values to later computations.
- How deep it goes
- Defines IO-block behavior first, then relates the syntax to monadic bind and Parser implementation.
- Examples
- Uses an echo program, a recursive numbered-input loop, monadic addition, and PNM-header parsers.
- What you can do after
- Apply it via Haskell IO and Parser actions to sequence work, bind results, and handle action-valued branches.
Functional Design and Architecture: Examples in Haskell
Do notation is Haskell syntax for expressing a sequence of monadic computations with implicit binding between steps.
- How it is used
- Simplifies sequences of monadic computations and separates functional scenarios from their eventual interpretation.
- How deep it goes
- Explains binding through Maybe and Free Monad examples, but defers the broader mechanics of monadic abstractions.
- Examples
- Uses user lookup with Maybe and a terminal script that reads and echoes two lines.
- What you can do after
- Apply it via Haskell do-notation to shorten monadic workflows and construct interpretable functional scenarios.
Read how Functional Design and Architecture: Examples in Haskell explains do notation →
Related concepts
- bindequivalent to · Bind is a monadic operation that sequences a context-bearing computation with a function producing the next computation while flattening the resulting nested context.
- IOconfigures · IO is an abstraction representing input/output or other side-effecting computations and operations, often as composable values whose execution is separately controlled.
- syntactic sugarkind of · Syntactic sugar is language syntax that provides a more convenient or readable form for expressing behavior already representable by other constructs without changing its meaning.
- monaduses · A monad is a functional abstraction that encapsulates computational context and provides operations for composing computations while preserving that context.
- let keywordcontrasts with · A let construct is a language feature that introduces a name binding associating an identifier with a value or expression.
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.

