The Tainted package

A Tainted type contains either a clean or dirty value. Values which are
clean stay clean as long as an operation performed on them results
in a clean value. If combined with a dirty value, the value becomes
tainted as dirty and remains that way through further operations.
This package contains implementations of the Tainted Monad as well as
TaintedT (the Tainted Monad Transformer), as well as examples of using
each of them.

Maintainer's Corner

Readme for Tainted-0.1.0.2

Tainted

Tainted type, and associated operations

A Tainted type contains either a clean or dirty value. Values which are
clean stay clean as long as an operation performed on them results
in a clean value. If combined with a dirty value, this taints the value
causing it to become dirty, and any further operation keeps it dirty.
This is similar to the Maybe monad except once the dirty has been
reached, calculations can still be performed on the value it contains.

One use case is evaluating whether expressions are pure from multiple
sources combining impure and pure values. This can be useful for
type checking to enforce purity in certain areas. As soon as an
impure part of an expression is reached it taints the entire
expression as impure.

A simple example given here is a expression evaluator which is given
values from different sources which are marked as pure or impure.