Monad package:ghc

The TPipelineClass and MonadUse classes and associated types
  • 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.
JS codegen state 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.
Get a unique from a monad that can access a unique supply. Crucially, because MonadGetUnique doesn't allow you to get the UniqSupply (unlike MonadUnique), an instance such as UniqDSM can use a deterministic unique supply to return deterministic uniques without allowing for the UniqSupply to be shared.
A monad for generating unique identifiers
Lift a f action into an m action.
An mtl-style class for monads that support parsing-related operations. For example, sometimes we make a second pass over the parsing results to validate, disambiguate, or rearrange them, and we do so in the PV monad which cannot consume input but can report parsing errors, check for extension bits, and accumulate parsing annotations. Both P and PV are instances of MonadP. MonadP grants us convenient overloading. The other option is to have separate operations for each monad: addErrorP vs addErrorPV, getBitP vs getBitPV, and so on.
Class that abstracts out the common ability of the monads in GHC to lookup a TyThing in the monadic environment by Name. Provides a number of related convenience functions for accessing particular kinds of TyThing