plutus-core-1.0.0.1: Language library for Plutus Core
Safe HaskellNone
LanguageHaskell2010

PlutusCore.Rename.Monad

Description

The monad that the renamer runs in and related infrastructure.

Synopsis

Documentation

newtype RenameT ren m a Source #

The monad the renamer runs in.

Constructors

RenameT 

Fields

Instances

Instances details
Monad m => MonadReader ren (RenameT ren m) Source # 
Instance details

Defined in PlutusCore.Rename.Monad

Methods

ask :: RenameT ren m ren

local :: (ren -> ren) -> RenameT ren m a -> RenameT ren m a

reader :: (ren -> a) -> RenameT ren m a

Monad m => Monad (RenameT ren m) Source # 
Instance details

Defined in PlutusCore.Rename.Monad

Methods

(>>=) :: RenameT ren m a -> (a -> RenameT ren m b) -> RenameT ren m b Source #

(>>) :: RenameT ren m a -> RenameT ren m b -> RenameT ren m b Source #

return :: a -> RenameT ren m a Source #

Functor m => Functor (RenameT ren m) Source # 
Instance details

Defined in PlutusCore.Rename.Monad

Methods

fmap :: (a -> b) -> RenameT ren m a -> RenameT ren m b Source #

(<$) :: a -> RenameT ren m b -> RenameT ren m a Source #

Applicative m => Applicative (RenameT ren m) Source # 
Instance details

Defined in PlutusCore.Rename.Monad

Methods

pure :: a -> RenameT ren m a Source #

(<*>) :: RenameT ren m (a -> b) -> RenameT ren m a -> RenameT ren m b Source #

liftA2 :: (a -> b -> c) -> RenameT ren m a -> RenameT ren m b -> RenameT ren m c Source #

(*>) :: RenameT ren m a -> RenameT ren m b -> RenameT ren m b Source #

(<*) :: RenameT ren m a -> RenameT ren m b -> RenameT ren m a Source #

Alternative m => Alternative (RenameT ren m) Source # 
Instance details

Defined in PlutusCore.Rename.Monad

Methods

empty :: RenameT ren m a Source #

(<|>) :: RenameT ren m a -> RenameT ren m a -> RenameT ren m a Source #

some :: RenameT ren m a -> RenameT ren m [a] Source #

many :: RenameT ren m a -> RenameT ren m [a] Source #

MonadQuote m => MonadQuote (RenameT ren m) Source # 
Instance details

Defined in PlutusCore.Rename.Monad

Methods

liftQuote :: Quote a -> RenameT ren m a Source #

newtype Renaming unique Source #

A renaming is a mapping from old uniques to new ones.

Constructors

Renaming 

Fields

Instances

Instances details
Semigroup (Renaming unique) Source # 
Instance details

Defined in PlutusCore.Rename.Monad

Methods

(<>) :: Renaming unique -> Renaming unique -> Renaming unique Source #

sconcat :: NonEmpty (Renaming unique) -> Renaming unique Source #

stimes :: Integral b => b -> Renaming unique -> Renaming unique Source #

Monoid (Renaming unique) Source # 
Instance details

Defined in PlutusCore.Rename.Monad

Methods

mempty :: Renaming unique Source #

mappend :: Renaming unique -> Renaming unique -> Renaming unique Source #

mconcat :: [Renaming unique] -> Renaming unique Source #

(Coercible unique1 Unique, unique1 ~ unique2) => HasRenaming (Renaming unique1) unique2 Source # 
Instance details

Defined in PlutusCore.Rename.Monad

Methods

renaming :: Lens' (Renaming unique1) (Renaming unique2) Source #

type TypeRenaming = Renaming TypeUnique Source #

A type-level renaming. Needed for instantiating functions running over types in generic RenameT ren m to a particular type of renaming.

class Coercible unique Unique => HasRenaming ren unique where Source #

A class that specifies which Renaming a ren has inside. A ren can contain several Renamings (like Scoped, for example).

Methods

renaming :: Lens' ren (Renaming unique) Source #

Instances

Instances details
HasRenaming ScopedRenaming TermUnique Source # 
Instance details

Defined in PlutusCore.Rename.Monad

HasRenaming ScopedRenaming TypeUnique Source # 
Instance details

Defined in PlutusCore.Rename.Monad

(Coercible unique1 Unique, unique1 ~ unique2) => HasRenaming (Renaming unique1) unique2 Source # 
Instance details

Defined in PlutusCore.Rename.Monad

Methods

renaming :: Lens' (Renaming unique1) (Renaming unique2) Source #

runRenameT :: Monoid ren => RenameT ren m a -> m a Source #

Run a RenameT computation with an empty renaming.

lookupNameM :: (HasUnique name unique, HasRenaming ren unique, MonadReader ren m) => name -> m (Maybe unique) Source #

Look up the new unique a name got mapped to.

renameNameM :: (HasRenaming ren unique, HasUnique name unique, MonadReader ren m) => name -> m name Source #

Rename a name that has a unique inside.

withFreshenedName :: (HasRenaming ren unique, HasUnique name unique, MonadQuote m, MonadReader ren m) => name -> (name -> m c) -> m c Source #

Replace the unique in a name by a new unique, save the mapping from the old unique to the new one and supply the updated value to a continuation.

withRenamedName :: (HasRenaming ren unique, HasUnique name unique, MonadReader ren m) => name -> name -> m c -> m c Source #

Run a RenameT computation in the environment extended by the mapping from an old name to a new one.