Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
UntypedPlutusCore.Transform.Inline
Contents
Description
An inlining pass.
This pass is essentially a copy of the PIR inliner, and should be KEPT IN SYNC with it. It's hard to do this with true abstraction, so we just have to keep two copies reasonably similar.
However, there are some differences. In the interests of making it easier to keep things in sync, these are explicitly listed in Note [Differences from PIR inliner]. If you add another difference, please note it there! Obviously fewer differences is better.
See Note [The problem of inlining destructors] for why this pass exists.
Synopsis
- inline ∷ ∀ name uni fun m a. ExternalConstraints name uni fun m ⇒ Size → Bool → Bool → InlineHints name a → BuiltinSemanticsVariant fun → Term name uni fun a → SimplifierT name uni fun a m (Term name uni fun a)
- newtype InlineHints name a = InlineHints {
- shouldInline ∷ a → name → Inline
- type InlineM name uni fun a = ReaderT (InlineInfo name fun a) (StateT (S name uni fun a) Quote)
- data S name uni fun a = S {
- _subst ∷ Subst name uni fun a
- _vars ∷ UniqueMap TermUnique (VarInfo name uni fun a)
- data InlineInfo name fun a = InlineInfo {}
- newtype Subst name uni fun a = Subst {}
- newtype TermEnv name uni fun a = TermEnv {
- _unTermEnv ∷ UniqueMap TermUnique (InlineTerm name uni fun a)
- isFirstVarBeforeEffects ∷ ∀ name uni fun ann. InliningConstraints name uni fun ⇒ BuiltinSemanticsVariant fun → name → Term name uni fun ann → Bool
- isStrictIn ∷ ∀ name uni fun a. Eq name ⇒ name → Term name uni fun a → Bool
- effectSafe ∷ ∀ name uni fun a. InliningConstraints name uni fun ⇒ Term name uni fun a → name → Bool → InlineM name uni fun a Bool
Documentation
Arguments
∷ ∀ name uni fun m a. ExternalConstraints name uni fun m | |
⇒ Size | inline threshold |
→ Bool | inline constants |
→ Bool | preserve logging |
→ InlineHints name a | |
→ BuiltinSemanticsVariant fun | |
→ Term name uni fun a | |
→ SimplifierT name uni fun a m (Term name uni fun a) |
Inline simple bindings. Relies on global uniqueness, and preserves it. See Note [Inlining and global uniqueness]
newtype InlineHints name a Source #
Constructors
InlineHints | |
Fields
|
Instances
Show (InlineHints name a) Source # | |
Defined in PlutusCore.Annotation | |
Default (InlineHints name a) Source # | |
Defined in PlutusCore.Annotation Methods def ∷ InlineHints name a Source # |
Exported for testing
type InlineM name uni fun a = ReaderT (InlineInfo name fun a) (StateT (S name uni fun a) Quote) Source #
The monad the inliner runs in.
data S name uni fun a Source #
UPLC inliner state
Constructors
S | |
Fields
|
data InlineInfo name fun a Source #
Constructors
InlineInfo | |
Fields |
newtype Subst name uni fun a Source #
Wrapper of term substitution so that it's similar to the PIR inliner. See Note [Differences from PIR inliner] 1
newtype TermEnv name uni fun a Source #
Term substitution, Subst
in the paper.
A map of unprocessed variable and its substitution range.
Constructors
TermEnv | |
Fields
|
isFirstVarBeforeEffects ∷ ∀ name uni fun ann. InliningConstraints name uni fun ⇒ BuiltinSemanticsVariant fun → name → Term name uni fun ann → Bool Source #