liveBook · Manning

Do notation

Do notation is Haskell syntax for sequencing monadic computations and binding their intermediate results in a readable, imperative-like form.

How 2 Manning books explain it

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.

Read how Learn Haskell by Example explains do notation →

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 →

Also covered in

What to know first

Related concepts

Questions about do notation

What is do notation?

Do notation is Haskell syntax for sequencing monadic computations and binding their intermediate results in a readable, imperative-like form.

Which Manning books explain do notation?

Learn Haskell by Example and Functional Design and Architecture: Examples in Haskell.

What should I know before learning do notation?

Manning books that teach do notation usually introduce Haskell and side effect first.

What is the difference between do notation and let keyword?

Do notation is Haskell syntax for sequencing monadic computations and binding their intermediate results in a readable, imperative-like form. A let construct is a language feature that introduces a name binding associating an identifier with a value or expression.

What is do notation a kind of?

Do notation is a kind of syntactic sugar. Syntactic sugar is language notation that makes an existing operation or construct more concise or convenient to express without changing its computational meaning.

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.