unbound-generics-0.4.3: Support for programming with names and binders using GHC Generics
Copyright(c) 2014 Aleksey Kliger
LicenseBSD3 (See LICENSE)
MaintainerAleksey Kliger
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Unbound.Generics.LocallyNameless.Fresh

Description

Global freshness monad.

Synopsis

Documentation

class Monad m => Fresh m where Source #

The Fresh type class governs monads which can generate new globally unique Names based on a given Name.

Methods

fresh :: Name a -> m (Name a) Source #

Generate a new globally unique name based on the given one.

Instances

Instances details
Fresh m => Fresh (MaybeT m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

fresh :: Name a -> MaybeT m (Name a) Source #

Fresh m => Fresh (FFM m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Alpha

Methods

fresh :: Name a -> FFM m (Name a) Source #

Monad m => Fresh (FreshMT m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

fresh :: Name a -> FreshMT m (Name a) Source #

(Error e, Fresh m) => Fresh (ErrorT e m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

fresh :: Name a -> ErrorT e m (Name a) Source #

Fresh m => Fresh (ExceptT e m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

fresh :: Name a -> ExceptT e m (Name a) Source #

Fresh m => Fresh (ReaderT r m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

fresh :: Name a -> ReaderT r m (Name a) Source #

Fresh m => Fresh (StateT s m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

fresh :: Name a -> StateT s m (Name a) Source #

Fresh m => Fresh (StateT s m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

fresh :: Name a -> StateT s m (Name a) Source #

(Monoid w, Fresh m) => Fresh (WriterT w m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

fresh :: Name a -> WriterT w m (Name a) Source #

(Monoid w, Fresh m) => Fresh (WriterT w m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

fresh :: Name a -> WriterT w m (Name a) Source #

newtype FreshMT m a Source #

The FreshM monad transformer. Keeps track of the lowest index still globally unused, and increments the index every time it is asked for a fresh name.

Constructors

FreshMT 

Fields

Instances

Instances details
MonadTrans FreshMT Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

lift :: Monad m => m a -> FreshMT m a #

MonadError e m => MonadError e (FreshMT m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

throwError :: e -> FreshMT m a #

catchError :: FreshMT m a -> (e -> FreshMT m a) -> FreshMT m a #

MonadReader r m => MonadReader r (FreshMT m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

ask :: FreshMT m r #

local :: (r -> r) -> FreshMT m a -> FreshMT m a #

reader :: (r -> a) -> FreshMT m a #

MonadState s m => MonadState s (FreshMT m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

get :: FreshMT m s #

put :: s -> FreshMT m () #

state :: (s -> (a, s)) -> FreshMT m a #

MonadWriter w m => MonadWriter w (FreshMT m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

writer :: (a, w) -> FreshMT m a #

tell :: w -> FreshMT m () #

listen :: FreshMT m a -> FreshMT m (a, w) #

pass :: FreshMT m (a, w -> w) -> FreshMT m a #

MonadFail m => MonadFail (FreshMT m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

fail :: String -> FreshMT m a #

MonadFix m => MonadFix (FreshMT m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

mfix :: (a -> FreshMT m a) -> FreshMT m a #

MonadIO m => MonadIO (FreshMT m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

liftIO :: IO a -> FreshMT m a #

MonadPlus m => Alternative (FreshMT m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

empty :: FreshMT m a #

(<|>) :: FreshMT m a -> FreshMT m a -> FreshMT m a #

some :: FreshMT m a -> FreshMT m [a] #

many :: FreshMT m a -> FreshMT m [a] #

Monad m => Applicative (FreshMT m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

pure :: a -> FreshMT m a #

(<*>) :: FreshMT m (a -> b) -> FreshMT m a -> FreshMT m b #

liftA2 :: (a -> b -> c) -> FreshMT m a -> FreshMT m b -> FreshMT m c #

(*>) :: FreshMT m a -> FreshMT m b -> FreshMT m b #

(<*) :: FreshMT m a -> FreshMT m b -> FreshMT m a #

Functor m => Functor (FreshMT m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

fmap :: (a -> b) -> FreshMT m a -> FreshMT m b #

(<$) :: a -> FreshMT m b -> FreshMT m a #

Monad m => Monad (FreshMT m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

(>>=) :: FreshMT m a -> (a -> FreshMT m b) -> FreshMT m b #

(>>) :: FreshMT m a -> FreshMT m b -> FreshMT m b #

return :: a -> FreshMT m a #

MonadPlus m => MonadPlus (FreshMT m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

mzero :: FreshMT m a #

mplus :: FreshMT m a -> FreshMT m a -> FreshMT m a #

MonadCatch m => MonadCatch (FreshMT m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

catch :: Exception e => FreshMT m a -> (e -> FreshMT m a) -> FreshMT m a #

MonadMask m => MonadMask (FreshMT m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

mask :: ((forall a. FreshMT m a -> FreshMT m a) -> FreshMT m b) -> FreshMT m b #

uninterruptibleMask :: ((forall a. FreshMT m a -> FreshMT m a) -> FreshMT m b) -> FreshMT m b #

generalBracket :: FreshMT m a -> (a -> ExitCase b -> FreshMT m c) -> (a -> FreshMT m b) -> FreshMT m (b, c) #

MonadThrow m => MonadThrow (FreshMT m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

throwM :: Exception e => e -> FreshMT m a #

MonadCont m => MonadCont (FreshMT m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

callCC :: ((a -> FreshMT m b) -> FreshMT m a) -> FreshMT m a #

Monad m => Fresh (FreshMT m) Source # 
Instance details

Defined in Unbound.Generics.LocallyNameless.Fresh

Methods

fresh :: Name a -> FreshMT m (Name a) Source #

runFreshMT :: Monad m => FreshMT m a -> m a Source #

Run a FreshMT computation (with the global index starting at zero).

contFreshMT :: Monad m => FreshMT m a -> Integer -> m a Source #

Run a FreshMT computation given a starting index for fresh name generation.

type FreshM = FreshMT Identity Source #

A convenient monad which is an instance of Fresh. It keeps track of a global index used for generating fresh names, which is incremented every time fresh is called.

runFreshM :: FreshM a -> a Source #

Run a FreshM computation (with the global index starting at zero).

contFreshM :: FreshM a -> Integer -> a Source #

Run a FreshM computation given a starting index.