Generalize do-notation to work on monads and indexed monads simultaneously.

LTS Haskell 16.20:
Stackage Nightly 2020-10-28:
Latest on Hackage:

See all snapshots do-notation appears in

BSD-3-Clause licensed by Sandy Maguire
Maintained by

Module documentation for

This version can be pinned in stack with:do-notation-,1472


Build Status | Hackage


I’ve just locked an open door. Strange, yet symbolically compelling.

Manny Calavera, Grim Fandango


Have you ever wanted to manage siiiick invariants with indexed monads without giving up your regular monads in the process? do-notation lets you do this with a bunch of type jiggery-pokery behind the scenes.

It also provides the Ix m indexed monad which is a free construction over a regular monad m. Cool.


{-# LANGUAGE RebindableSyntax #-}

import Language.Haskell.DoNotation
import Prelude hiding (Monad (..), pure)


The implementation doesn’t play very nicely with do-blocks bound via let.


Huge shout-outs to Csongor Kiss for very patiently walking me through the incoherent instance machinery necessary to make this all work.


Changelog for do-notation

2018-09-09 –

Loosen constraint on PureSyntax down to Applicative.

2018-09-07 –

First release!

Unreleased changes

Depends on 2 packages(full list with versions):