Portability | GHC only |
---|---|
Maintainer | Simon Meier <iridcode@gmail.com> |
Safe Haskell | None |
Shallow monad transformer for dealing with bindings.
- type Bindings = Map
- noBindings :: Bindings v k
- class MonadState (Bindings k v) m => MonadBind k v m
- type Bind k v = State (Bindings k v)
- runBind :: Bind k v a -> Bindings k v -> (a, Bindings k v)
- evalBind :: Bind k v a -> Bindings k v -> a
- execBind :: Bind k v a -> Bindings k v -> Bindings k v
- type BindT k v = StateT (Bindings k v)
- runBindT :: BindT k v m a -> Bindings k v -> m (a, Bindings k v)
- evalBindT :: Monad m => BindT k v m a -> Bindings k v -> m a
- execBindT :: Monad m => BindT k v m a -> Bindings k v -> m (Bindings k v)
- lookupBinding :: (MonadBind k v m, Ord k) => k -> m (Maybe v)
- insertBinding :: (MonadBind k v m, Ord k) => k -> v -> m ()
- importBinding :: (MonadBind k v m, MonadFresh m, Show v, Show k, Ord k) => (String -> Integer -> v) -> k -> String -> m v
- module Control.Monad.Fresh
Bindings
noBindings :: Bindings v kSource
The empty binding store.
MonadBind class
class MonadState (Bindings k v) m => MonadBind k v m Source
Bind monad
BindT monad transformer
runBindT :: BindT k v m a -> Bindings k v -> m (a, Bindings k v)Source
Run a computation with bindings.
evalBindT :: Monad m => BindT k v m a -> Bindings k v -> m aSource
Evaluate a binding context computation.
execBindT :: Monad m => BindT k v m a -> Bindings k v -> m (Bindings k v)Source
Execute a binding context computation.
Binding operations
lookupBinding :: (MonadBind k v m, Ord k) => k -> m (Maybe v)Source
Lookup a stored binding.
insertBinding :: (MonadBind k v m, Ord k) => k -> v -> m ()Source
insertBinding k v
inserts the binding of k
to v
, possibly
overwriting the existing binding of k
.
importBinding :: (MonadBind k v m, MonadFresh m, Show v, Show k, Ord k) => (String -> Integer -> v) -> k -> String -> m vSource
importBinding mkR d n
checks if there is already a binding registered
for the value d
and if not it generates a fresh identifier using the name
n
as a hint and converting name and identifier to a value using $mkR$.
module Control.Monad.Fresh