plutus-core-1.36.0.0: Language library for Plutus Core
Safe HaskellSafe-Inferred
LanguageHaskell2010

PlutusCore.Rename

Description

The user-facing API of the renamer.

Synopsis

Documentation

data Renamed a Source #

A wrapper for signifying that the value inside of it satisfies global uniqueness.

It's safe to call unRenamed, it's not safe to call Renamed, hence the latter is only exported from this internal module and should not be exported from the main API.

Don't provide any instances allowing the user to create a Renamed (even out of an existing one like with Functor).

Instances

Instances details
Show a => Show (Renamed a) Source # 
Instance details

Defined in PlutusCore.Rename.Internal

Eq a => Eq (Renamed a) Source # 
Instance details

Defined in PlutusCore.Rename.Internal

Methods

(==) :: Renamed a -> Renamed a -> Bool Source #

(/=) :: Renamed a -> Renamed a -> Bool Source #

class Rename a where Source #

The class of things that can be renamed. I.e. things that are capable of satisfying the global uniqueness condition.

Methods

rename :: MonadQuote m => a -> m a Source #

Rename Uniques so that they're globally unique. In case there are any free variables, they must be left untouched and bound variables must not get renamed to free ones. Must always assign new names to bound variables, so that rename can be used for alpha-renaming as well.

Instances

Instances details
Rename a => Rename (Normalized a) Source # 
Instance details

Defined in PlutusCore.Rename

Methods

rename :: MonadQuote m => Normalized a -> m (Normalized a) Source #

HasUniques (Type tyname uni ann) => Rename (Type tyname uni ann) Source # 
Instance details

Defined in PlutusCore.Rename

Methods

rename :: MonadQuote m => Type tyname uni ann -> m (Type tyname uni ann) Source #

HasUniques (Program name uni fun ann) => Rename (Program name uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Rename

Methods

rename :: MonadQuote m => Program name uni fun ann -> m (Program name uni fun ann) Source #

HasUniques (Term name uni fun ann) => Rename (Term name uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Rename

Methods

rename :: MonadQuote m => Term name uni fun ann -> m (Term name uni fun ann) Source #

HasUniques (Program tyname name uni fun ann) => Rename (Program tyname name uni fun ann) Source # 
Instance details

Defined in PlutusCore.Rename

Methods

rename :: MonadQuote m => Program tyname name uni fun ann -> m (Program tyname name uni fun ann) Source #

HasUniques (Term tyname name uni fun ann) => Rename (Term tyname name uni fun ann) Source # 
Instance details

Defined in PlutusCore.Rename

Methods

rename :: MonadQuote m => Term tyname name uni fun ann -> m (Term tyname name uni fun ann) Source #

getRenamed :: (Rename a, MonadQuote m) => a -> m (Renamed a) Source #

rename a value and wrap the result in Renamed, so that it can be passed around and it's visible in the types that the thing inside satisfies global uniqueness.

data Dupable a Source #

Dupable a is isomorphic to a, but the only way to extract the a is via liftDupable (defined in the main API module because of a constraint requirement) which renames the stored value along the way. This type is used whenever

  1. preserving global uniqueness is required
  2. some value may be used multiple times

so we annotate such a value with Dupable and call liftDupable at each usage, which ensures global uniqueness is preserved.

unDupable is not supposed to be exported. Don't provide any instances allowing the user to access the underlying value.

Instances

Instances details
Show a => Show (Dupable a) Source # 
Instance details

Defined in PlutusCore.Rename.Internal

Eq a => Eq (Dupable a) Source # 
Instance details

Defined in PlutusCore.Rename.Internal

Methods

(==) :: Dupable a -> Dupable a -> Bool Source #

(/=) :: Dupable a -> Dupable a -> Bool Source #

dupable :: a -> Dupable a Source #

Wrap a value in Dupable.

liftDupable :: (MonadQuote m, Rename a) => Dupable a -> m a Source #

Extract the value stored in a Dupable a and rename it.