tamarin-prover-utils-1.2.2: Utility library for the tamarin prover.

Copyright | (c) 2010 2011 Simon Meier
License | GPL v3 (see LICENSE)
Maintainer | Simon Meier <iridcode@gmail.com>
Portability | GHC only
Safe Haskell | None
Language | Haskell98

Control.Monad.Bind

Contents

- Bindings
- MonadBind class
- Bind monad
- BindT monad transformer
- Binding operations

Description

Shallow monad transformer for dealing with bindings.

Synopsis

- 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, Ord k) => (String -> Integer -> v) -> k -> String -> m v
- module Control.Monad.Fresh

# Bindings

type Bindings = Map #

Type constructor for the state of the binding store.

noBindings :: Bindings v k #

The empty binding store.

# MonadBind class

class MonadState (Bindings k v) m => MonadBind k v m #

Instances

MonadBind k v m => MonadBind k v (FreshT m) # |
MonadBind k v m => MonadBind k v (FreshT m) # |
Monad m => MonadBind k v (StateT (Bindings k v) m) # |

# Bind monad

type Bind k v = State (Bindings k v) #

Managing just bindings.

runBind :: Bind k v a -> Bindings k v -> (a, Bindings k v) #

Run a computation with bindings.

evalBind :: Bind k v a -> Bindings k v -> a #

Evaluate a binding context computation.

execBind :: Bind k v a -> Bindings k v -> Bindings k v #

Execute a binding context computation.

# BindT monad transformer

type BindT k v = StateT (Bindings k v) #

Managing bindings on top of another monad.

runBindT :: BindT k v m a -> Bindings k v -> m (a, Bindings k v) #

Run a computation with bindings.

evalBindT :: Monad m => BindT k v m a -> Bindings k v -> m a #

Evaluate a binding context computation.

execBindT :: Monad m => BindT k v m a -> Bindings k v -> m (Bindings k v) #

Execute a binding context computation.

# Binding operations

lookupBinding :: (MonadBind k v m, Ord k) => k -> m (Maybe v) #

Lookup a stored binding.

insertBinding :: (MonadBind k v m, Ord k) => k -> v -> m () #

`insertBinding k v` inserts the binding of `k` to `v`, possibly overwriting the existing binding of `k`.

importBinding :: (MonadBind k v m, MonadFresh m, Ord k) => (String -> Integer -> v) -> k -> String -> m v #

`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