Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
The user-facing API of the renamer.
Synopsis
- data Renamed a
- class Rename a where
- rename ∷ MonadQuote m ⇒ a → m a
- getRenamed ∷ (Rename a, MonadQuote m) ⇒ a → m (Renamed a)
- data Dupable a
- dupable ∷ a → Dupable a
- liftDupable ∷ (MonadQuote m, Rename a) ⇒ Dupable a → m a
Documentation
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
).
The class of things that can be renamed. I.e. things that are capable of satisfying the global uniqueness condition.
rename ∷ MonadQuote m ⇒ a → m a Source #
Rename Unique
s 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
Rename a ⇒ Rename (Normalized a) Source # | |
Defined in PlutusCore.Rename rename ∷ MonadQuote m ⇒ Normalized a → m (Normalized a) Source # | |
HasUniques (Type tyname uni ann) ⇒ Rename (Type tyname uni ann) Source # | |
Defined in PlutusCore.Rename | |
HasUniques (Program name uni fun ann) ⇒ Rename (Program name uni fun ann) Source # | |
Defined in UntypedPlutusCore.Rename | |
HasUniques (Term name uni fun ann) ⇒ Rename (Term name uni fun ann) Source # | |
Defined in UntypedPlutusCore.Rename | |
HasUniques (Program tyname name uni fun ann) ⇒ Rename (Program tyname name uni fun ann) Source # | |
Defined in PlutusCore.Rename | |
HasUniques (Term tyname name uni fun ann) ⇒ Rename (Term tyname name uni fun ann) Source # | |
Defined in PlutusCore.Rename |
getRenamed ∷ (Rename a, MonadQuote m) ⇒ a → m (Renamed 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
- preserving global uniqueness is required
- 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.
liftDupable ∷ (MonadQuote m, Rename a) ⇒ Dupable a → m a Source #
Extract the value stored in a Dupable a
and rename it.