External Explanations

Contravariant

Comonad

IndexedMonad (i.e. IxMonad)

An IndexedMonad uses the compiler to ensure:

  1. monadic computations occur in the proper order
  2. one monadic computation will change what the final output will be

Links:

Real-world problem where it would help: purescript-selda, a library that allows one to write type-safe database queries, would prevent some aggregate queries from working when they are invalid. The (thesis' (PDF)) relevant sections are 2.3, 2.4, and 5 (paragraph 5 and down).