bound-gen-0.1.0.2: Unwrap Scope's with globally fresh values

Safe HaskellSafe
LanguageHaskell2010

Bound.Unwrap

Synopsis

Documentation

data Fresh a Source

Instances

Eq a => Eq (Fresh a) Source 
Ord a => Ord (Fresh a) Source 
Show a => Show (Fresh a) Source 

name :: a -> Fresh a Source

Create a name. This name isn't unique at all at this point. Once you have a name you can pass it to freshify to render it unique within the current monadic context.

freshify :: MonadUnwrap m => Fresh a -> m (Fresh a) Source

Render a name unique within the scope of a monadic computation.

type UnwrapT = GenT Counter Source

A specialized version of GenT used for unwrapping things.

runUnwrapT :: Monad m => UnwrapT m a -> m a Source

unwrap :: (Monad f, Functor m, MonadUnwrap m) => Fresh a -> Scope () f (Fresh a) -> m (Fresh a, f (Fresh a)) Source

Given a scope which binds one variable, unwrap it with a variable. Note that unwrap will take care of freshifying the varable.

unwrapAll :: (Monad f, MonadUnwrap m) => Fresh a -> [Scope () f (Fresh a)] -> m (Fresh a, [f (Fresh a)]) Source

Given a list of scopes which bind one variable, unwrap them all with the same variable. Note that unwrapAll will take care of freshifying the variable.