| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
LLVM.IRBuilder.Class
Description
MTL-style typeclass for IR builder operations.
This module provides the MonadIRBuilder typeclass, which abstracts over
the core operations needed for LLVM IR construction. It follows the MTL pattern
of providing lift-through instances for common transformers, allowing
IRBuilderT to be stacked with ReaderT, StateT, WriterT, etc.
The class provides three primitives:
getIRBuilderEnv: Access the current builder stateputIRBuilderEnv: Replace the builder statethrowIRBuilderError: Throw a builder error
Default methods modifyIRBuilderEnv and getsIRBuilderEnv are provided
for convenience.
Synopsis
- class Monad m => MonadIRBuilder (m :: Type -> Type) where
- getIRBuilderEnv :: m IRBuilderEnv
- putIRBuilderEnv :: IRBuilderEnv -> m ()
- throwIRBuilderError :: IRBuilderError -> m a
- modifyIRBuilderEnv :: (IRBuilderEnv -> IRBuilderEnv) -> m ()
- getsIRBuilderEnv :: (IRBuilderEnv -> a) -> m a
Documentation
class Monad m => MonadIRBuilder (m :: Type -> Type) where Source #
MTL-style typeclass for monads that support IR building operations.
This class provides primitives for accessing and modifying the builder environment and throwing builder-specific errors. It is designed to be composable with other monad transformers via lift-through instances.
Minimal complete definition: getIRBuilderEnv, putIRBuilderEnv, throwIRBuilderError
Minimal complete definition
Methods
getIRBuilderEnv :: m IRBuilderEnv Source #
Retrieve the current builder environment.
putIRBuilderEnv :: IRBuilderEnv -> m () Source #
Replace the current builder environment.
throwIRBuilderError :: IRBuilderError -> m a Source #
Throw a builder error, short-circuiting the computation.
modifyIRBuilderEnv :: (IRBuilderEnv -> IRBuilderEnv) -> m () Source #
Modify the builder environment using a function.
Default implementation in terms of getIRBuilderEnv and putIRBuilderEnv.
getsIRBuilderEnv :: (IRBuilderEnv -> a) -> m a Source #
Retrieve a projection of the builder environment.
Default implementation in terms of getIRBuilderEnv.