A class declaration introduces a new type class and the overloaded operations that must be supported by any type that is an instance of that class.
> class Num a where
> (+) :: a -> a -> a
> negate :: a -> a

Conditionally labels test case.

indentation of a class or instance

* *Computation type:* Computations which can be interrupted and resumed.
* *Binding strategy:* Binding a function to a monadic value creates a new continuation which uses the function as the continuation of the monadic computation.
* *Useful for:* Complex control structures, error handling, and creating co-routines.
* *Zero and plus:* None.
* *Example type:* Cont r a
The Continuation monad represents computations in continuation-passing style (CPS). In continuation-passing style function result is not returned, but instead is passed to another function, received as a parameter (continuation). Computations are built up from sequences of nested continuations, terminated by a final continuation (often id) which produces the final result. Since continuations are functions which represent the future of a computation, manipulation of the continuation functions can achieve complex manipulations of the future of the computation, such as interrupting a computation in the middle, aborting a portion of a computation, restarting a computation, and interleaving execution of computations. The Continuation monad adapts CPS to the structure of a monad.
Before using the Continuation monad, be sure that you have a firm understanding of continuation-passing style and that continuations represent the best solution to your particular design problem. Many algorithms which require continuations in other languages do not require them in Haskell, due to Haskell's lazy semantics. Abuse of the Continuation monad can produce code that is impossible to understand and maintain.

* *Computation type:* Computations which may fail or throw exceptions.
* *Binding strategy:* Failure records information about the cause/location of the failure. Failure values bypass the bound function, other values are used as inputs to the bound function.
* *Useful for:* Building computations from sequences of functions that may fail or using exception handling to structure error handling.
* *Zero and plus:* Zero is represented by an empty error and the plus operation executes its second argument if the first fails.
* *Example type:* Either String a
The Error monad (also called the Exception monad).

Class of monads based on IO.

* *Computation type:* Computations which read values from a shared environment.
* *Binding strategy:* Monad values are functions from the environment to a value. The bound function is applied to the bound value, and both have access to the shared environment.
* *Useful for:* Maintaining variable bindings, or other shared environment.
* *Zero and plus:* None.
* *Example type:* Reader [(String,Value)] a
The Reader monad (also called the Environment monad). Represents a computation, which can read values from a shared environment, pass values from function to function, and execute sub-computations in a modified environment. Using Reader monad for such computations is often clearer and easier than using the State monad.
Inspired by the paper *Functional Programming with Overloading and Higher-Order Polymorphism*, Mark P Jones (http://web.cecs.pdx.edu/~mpj/) Advanced School of Functional Programming, 1995.

Declaration of the MonadRWS class.
Inspired by the paper *Functional Programming with Overloading and Higher-Order Polymorphism*, Mark P Jones (http://web.cecs.pdx.edu/~mpj/) Advanced School of Functional Programming, 1995.

MonadState class.
This module is inspired by the paper *Functional Programming with Overloading and Higher-Order Polymorphism*, Mark P Jones (http://web.cecs.pdx.edu/~mpj/) Advanced School of Functional Programming, 1995.

Classes for monad transformers.
A monad transformer makes a new monad out of an existing monad, such that computations of the old monad may be embedded in the new one. To construct a monad with a desired set of features, one typically starts with a base monad, such as Identity, [] or IO, and applies a sequence of monad transformers.
Most monad transformer modules include the special case of applying the transformer to Identity. For example, State s is an abbreviation for StateT s Identity.
Each monad transformer also comes with an operation run*XXX* to unwrap the transformer, exposing a computation of the inner monad.

The MonadWriter class.
Inspired by the paper *Functional Programming with Overloading and Higher-Order Polymorphism*, Mark P Jones (http://web.cecs.pdx.edu/~mpj/pubs/springschool.html) Advanced School of Functional Programming, 1995.

> { class Eq a => Ord a

A class, with a list of its visible instances

A class method

> Eq (Int, a)