Monad
The
Monad class defines the basic operations over a
monad, a concept from a branch of mathematics known as
category theory. From the perspective of a Haskell programmer,
however, it is best to think of a monad as an
abstract datatype
of actions. Haskell's
do expressions provide a convenient
syntax for writing monadic expressions.
Instances of
Monad should satisfy the following:
Furthermore, the
Monad and
Applicative operations should
relate as follows:
The above laws imply:
and that
pure and (
<*>) satisfy the applicative
functor laws.
The instances of
Monad for
List,
Maybe and
IO defined in the
Prelude satisfy these laws.
The environment in which most criterion code executes.
The
Monad class defines the basic operations over a
monad, a concept from a branch of mathematics known as
category theory. From the perspective of a Haskell programmer,
however, it is best to think of a monad as an
abstract datatype
of actions. Haskell's
do expressions provide a convenient
syntax for writing monadic expressions.
Instances of
Monad should satisfy the following:
Furthermore, the
Monad and
Applicative operations should
relate as follows:
The above laws imply:
and that
pure and (
<*>) satisfy the applicative
functor laws.
The instances of
Monad for lists,
Maybe and
IO
defined in the
Prelude satisfy these laws.
- Domain and PurposeGHC.JS.JStg.Monad defines the computational
environment for the eDSL that we use to write the JS Backend's RTS.
Its purpose is to ensure unique identifiers are generated throughout
the backend and that we can use the host language to ensure references
are not mixed.
- StrategyThe monad is a straightforward state monad which holds an
environment holds a pointer to a prefix to tag identifiers with and an
infinite stream of identifiers.
- UsageOne should almost never need to directly use the functions in
this module. Instead one should opt to use the combinators in
Make, the sole exception to this is the withTag
function which is used to change the prefix of identifiers for a given
computation. For example, the rts uses this function to tag all
identifiers generated by the RTS code as RTS_N, where N is some
unique.
Hides away distracting bookkeeping while lambda lifting into a
LiftM monad.
Monadic definitions for the constraint solver
Functions for working with the typechecker environment (setters,
getters...).
The
ZonkM monad, a stripped down
TcM, used when
zonking within the typechecker in
GHC.Tc.Zonk.TcType.
See Note [Module structure for zonking] in GHC.Tc.Zonk.Type.
Utilities related to Monad and Applicative classes Mostly for
backwards compatibility.
Reexporting useful monadic stuff.