ir-builder-0.1.0.0: Monadic DSL for constructing LLVM IR
Safe HaskellSafe-Inferred
LanguageHaskell2010

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:

Default methods modifyIRBuilderEnv and getsIRBuilderEnv are provided for convenience.

Synopsis

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

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.

Instances

Instances details
Monad m => MonadIRBuilder (IRBuilderT m) Source #

IRBuilderT instance for MonadIRBuilder

Instance details

Defined in LLVM.IRBuilder

MonadIRBuilder m => MonadIRBuilder (ExceptT e m) Source #

Lift through ExceptT.

Instance details

Defined in LLVM.IRBuilder.Class

MonadIRBuilder m => MonadIRBuilder (ReaderT r m) Source #

Lift through ReaderT.

Instance details

Defined in LLVM.IRBuilder.Class

MonadIRBuilder m => MonadIRBuilder (StateT s m) Source #

Lift through StateT.

Instance details

Defined in LLVM.IRBuilder.Class

(MonadIRBuilder m, Monoid w) => MonadIRBuilder (WriterT w m) Source #

Lift through WriterT.

Instance details

Defined in LLVM.IRBuilder.Class