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

PlutusCore.Rename.Internal

Description

The internal module of the renamer that defines the actual algorithms, but not the user-facing API.

Synopsis

Documentation

newtype 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).

Constructors

Renamed 

Fields

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 #

newtype 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.

Constructors

Dupable 

Fields

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 #

withFreshenedTyVarDecl :: (HasRenaming ren TypeUnique, HasUniques (Type tyname uni ann), MonadQuote m, MonadReader ren m) => TyVarDecl tyname ann -> (TyVarDecl tyname ann -> m c) -> m c Source #

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

withFreshenedVarDecl :: (HasUniques (Term tyname name uni fun ann), MonadQuote m, MonadReader ScopedRenaming m) => VarDecl tyname name uni ann -> (m (VarDecl tyname name uni ann) -> m c) -> m c Source #

Replace the unique in the name stored in a VarDecl by a new unique, save the mapping from the old unique to the new one and supply to a continuation the computation that renames the type stored in the updated VarDecl. The reason the continuation receives a computation rather than a pure term is that we may want to bring several term and type variables in scope before renaming the types of term variables. This situation arises when we want to rename a bunch of mutually recursive bindings.

renameTypeM :: (HasRenaming ren TypeUnique, HasUniques (Type tyname uni ann), MonadQuote m, MonadReader ren m) => Type tyname uni ann -> m (Type tyname uni ann) Source #

Rename a Kind in the RenameM monad.

renameTermM :: (HasUniques (Term tyname name uni fun ann), MonadQuote m, MonadReader ScopedRenaming m) => Term tyname name uni fun ann -> m (Term tyname name uni fun ann) Source #

Rename a Term in the RenameM monad.

renameProgramM :: (HasUniques (Program tyname name uni fun ann), MonadQuote m, MonadReader ScopedRenaming m) => Program tyname name uni fun ann -> m (Program tyname name uni fun ann) Source #

Rename a Program in the RenameM monad.