Safe Haskell | None |
---|---|
Language | Haskell2010 |
UntypedPlutusCore
Synopsis
- module PlutusCore.Name
- substVarA :: Applicative f => (name -> f (Maybe (Term name uni fun ann))) -> Term name uni fun ann -> f (Term name uni fun ann)
- substVar :: (name -> Maybe (Term name uni fun ann)) -> Term name uni fun ann -> Term name uni fun ann
- termSubstNamesM :: Monad m => (name -> m (Maybe (Term name uni fun ann))) -> Term name uni fun ann -> m (Term name uni fun ann)
- termSubstNames :: (name -> Maybe (Term name uni fun ann)) -> Term name uni fun ann -> Term name uni fun ann
- termSubstFreeNamesA :: (Applicative f, HasUnique name TermUnique) => (name -> f (Maybe (Term name uni fun ann))) -> Term name uni fun ann -> f (Term name uni fun ann)
- termSubstFreeNames :: HasUnique name TermUnique => (name -> Maybe (Term name uni fun ann)) -> Term name uni fun ann -> Term name uni fun ann
- termMapNames :: forall name name' uni fun ann. (name -> name') -> Term name uni fun ann -> Term name' uni fun ann
- programMapNames :: forall name name' uni fun ann. (name -> name') -> Program name uni fun ann -> Program name' uni fun ann
- uniquesTerm :: HasUniques (Term name uni fun ann) => Term name uni fun ann -> Set Unique
- vTerm :: Ord name => Term name uni fun ann -> Set name
- termSize :: Term name uni fun ann -> Integer
- programSize :: Program name uni fun ann -> Integer
- serialisedSize :: Flat a => a -> Integer
- simplifyTerm :: forall uni fun m a. (ToBuiltinMeaning uni fun, MonadQuote m) => SimplifyOpts a -> Term Name uni fun a -> m (Term Name uni fun a)
- simplifyProgram :: forall uni fun m a. (ToBuiltinMeaning uni fun, MonadQuote m) => SimplifyOpts a -> Program Name uni fun a -> m (Program Name uni fun a)
- data SimplifyOpts a = SimplifyOpts {}
- soMaxSimplifierIterations :: forall a. Lens' (SimplifyOpts a) Int
- soInlineHints :: forall a a. Lens (SimplifyOpts a) (SimplifyOpts a) (InlineHints Name a) (InlineHints Name a)
- defaultSimplifyOpts :: SimplifyOpts a
- newtype InlineHints name a = InlineHints {
- shouldInline :: a -> name -> Bool
- module UntypedPlutusCore.DeBruijn
- module UntypedPlutusCore.Core
- data Term name uni fun ann
- data Program name uni fun ann = Program {}
- applyProgram :: Program name uni fun () -> Program name uni fun () -> Program name uni fun ()
- parseScoped :: (MonadQuote (Either (ParseErrorBundle Text ParseError)), AsUniqueError (ParseErrorBundle Text ParseError) SourcePos) => ByteString -> Either (ParseErrorBundle Text ParseError) (Program Name DefaultUni DefaultFun SourcePos)
- data DefaultUni a
- data DefaultFun
Documentation
module PlutusCore.Name
substVarA :: Applicative f => (name -> f (Maybe (Term name uni fun ann))) -> Term name uni fun ann -> f (Term name uni fun ann) Source #
Applicatively replace a variable using the given function.
substVar :: (name -> Maybe (Term name uni fun ann)) -> Term name uni fun ann -> Term name uni fun ann Source #
Replace a variable using the given function.
termSubstNamesM :: Monad m => (name -> m (Maybe (Term name uni fun ann))) -> Term name uni fun ann -> m (Term name uni fun ann) Source #
Naively monadically substitute names using the given function (i.e. do not substitute binders).
termSubstNames :: (name -> Maybe (Term name uni fun ann)) -> Term name uni fun ann -> Term name uni fun ann Source #
Naively substitute names using the given function (i.e. do not substitute binders).
termSubstFreeNamesA :: (Applicative f, HasUnique name TermUnique) => (name -> f (Maybe (Term name uni fun ann))) -> Term name uni fun ann -> f (Term name uni fun ann) Source #
Applicatively substitute *free* names using the given function.
termSubstFreeNames :: HasUnique name TermUnique => (name -> Maybe (Term name uni fun ann)) -> Term name uni fun ann -> Term name uni fun ann Source #
Substitute *free* names using the given function.
termMapNames :: forall name name' uni fun ann. (name -> name') -> Term name uni fun ann -> Term name' uni fun ann Source #
Completely replace the names with a new name type.
programMapNames :: forall name name' uni fun ann. (name -> name') -> Program name uni fun ann -> Program name' uni fun ann Source #
uniquesTerm :: HasUniques (Term name uni fun ann) => Term name uni fun ann -> Set Unique Source #
Get all the uniques in a term
vTerm :: Ord name => Term name uni fun ann -> Set name Source #
Get all the term variables in a term.
programSize :: Program name uni fun ann -> Integer Source #
Count the number of AST nodes in a program.
serialisedSize :: Flat a => a -> Integer Source #
Compute the size of the serialized form of a value.
simplifyTerm :: forall uni fun m a. (ToBuiltinMeaning uni fun, MonadQuote m) => SimplifyOpts a -> Term Name uni fun a -> m (Term Name uni fun a) Source #
simplifyProgram :: forall uni fun m a. (ToBuiltinMeaning uni fun, MonadQuote m) => SimplifyOpts a -> Program Name uni fun a -> m (Program Name uni fun a) Source #
data SimplifyOpts a Source #
Constructors
SimplifyOpts | |
Fields |
Instances
Show (SimplifyOpts a) Source # | |
Defined in UntypedPlutusCore.Simplify |
soMaxSimplifierIterations :: forall a. Lens' (SimplifyOpts a) Int Source #
soInlineHints :: forall a a. Lens (SimplifyOpts a) (SimplifyOpts a) (InlineHints Name a) (InlineHints Name a) Source #
newtype InlineHints name a Source #
Constructors
InlineHints | |
Fields
|
Instances
Show (InlineHints name a) Source # | |
Defined in PlutusCore.InlineUtils | |
Semigroup (InlineHints name a) Source # | |
Defined in PlutusCore.InlineUtils Methods (<>) :: InlineHints name a -> InlineHints name a -> InlineHints name a Source # sconcat :: NonEmpty (InlineHints name a) -> InlineHints name a Source # stimes :: Integral b => b -> InlineHints name a -> InlineHints name a Source # | |
Monoid (InlineHints name a) Source # | |
Defined in PlutusCore.InlineUtils Methods mempty :: InlineHints name a Source # mappend :: InlineHints name a -> InlineHints name a -> InlineHints name a Source # mconcat :: [InlineHints name a] -> InlineHints name a Source # |
module UntypedPlutusCore.DeBruijn
module UntypedPlutusCore.Core
data Term name uni fun ann Source #
The type of Untyped Plutus Core terms. Mirrors the type of Typed Plutus Core terms except
- all types are removed
IWrap
andUnwrap
are removed- type abstractions are replaced with
Delay
- type instantiations are replaced with
Force
The latter two are due to the fact that we don't have value restriction in Typed Plutus Core
and hence a computation can be stuck expecting only a single type argument for the computation
to become unstuck. Therefore we can't just silently remove type abstractions and instantiations and
need to replace them with something else that also blocks evaluation (in order for the semantics
of an erased program to match with the semantics of the original typed one). Delay
and Force
serve exactly this purpose.
Constructors
Var !ann !name | |
LamAbs !ann !name !(Term name uni fun ann) | |
Apply !ann !(Term name uni fun ann) !(Term name uni fun ann) | |
Force !ann !(Term name uni fun ann) | |
Delay !ann !(Term name uni fun ann) | |
Constant !ann !(Some (ValueOf uni)) | |
Builtin !ann !fun | |
Error !ann |
Instances
DefaultPrettyPlcStrategy (Term name uni fun ann) => PrettyBy PrettyConfigPlc (Term name uni fun ann) Source # | |
Defined in UntypedPlutusCore.Core.Instance.Pretty.Plc Methods prettyBy :: PrettyConfigPlc -> Term name uni fun ann -> Doc ann0 # prettyListBy :: PrettyConfigPlc -> [Term name uni fun ann] -> Doc ann0 # | |
(PrettyReadableBy configName name, GShow uni, Closed uni, Everywhere uni PrettyConst, Pretty fun) => PrettyBy (PrettyConfigReadable configName) (Term name uni fun a) Source # | |
Defined in UntypedPlutusCore.Core.Instance.Pretty.Readable Methods prettyBy :: PrettyConfigReadable configName -> Term name uni fun a -> Doc ann # prettyListBy :: PrettyConfigReadable configName -> [Term name uni fun a] -> Doc ann # | |
(PrettyClassicBy configName name, GShow uni, Closed uni, Everywhere uni PrettyConst, Pretty fun, Pretty ann) => PrettyBy (PrettyConfigClassic configName) (Term name uni fun ann) Source # | |
Defined in UntypedPlutusCore.Core.Instance.Pretty.Classic Methods prettyBy :: PrettyConfigClassic configName -> Term name uni fun ann -> Doc ann0 # prettyListBy :: PrettyConfigClassic configName -> [Term name uni fun ann] -> Doc ann0 # | |
Functor (Term name uni fun) Source # | |
TermLike (Term name uni fun) TyName name uni fun Source # | |
Defined in UntypedPlutusCore.Core.Type Methods var :: ann -> name -> Term name uni fun ann Source # tyAbs :: ann -> TyName -> Kind ann -> Term name uni fun ann -> Term name uni fun ann Source # lamAbs :: ann -> name -> Type TyName uni ann -> Term name uni fun ann -> Term name uni fun ann Source # apply :: ann -> Term name uni fun ann -> Term name uni fun ann -> Term name uni fun ann Source # constant :: ann -> Some (ValueOf uni) -> Term name uni fun ann Source # builtin :: ann -> fun -> Term name uni fun ann Source # tyInst :: ann -> Term name uni fun ann -> Type TyName uni ann -> Term name uni fun ann Source # unwrap :: ann -> Term name uni fun ann -> Term name uni fun ann Source # iWrap :: ann -> Type TyName uni ann -> Type TyName uni ann -> Term name uni fun ann -> Term name uni fun ann Source # error :: ann -> Type TyName uni ann -> Term name uni fun ann Source # termLet :: ann -> TermDef (Term name uni fun) TyName name uni fun ann -> Term name uni fun ann -> Term name uni fun ann Source # typeLet :: ann -> TypeDef TyName uni ann -> Term name uni fun ann -> Term name uni fun ann Source # | |
PrettyUni uni fun => MonadError (CekEvaluationException NamedDeBruijn uni fun) (CekM uni fun s) | |
Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal Methods throwError :: CekEvaluationException NamedDeBruijn uni fun -> CekM uni fun s a catchError :: CekM uni fun s a -> (CekEvaluationException NamedDeBruijn uni fun -> CekM uni fun s a) -> CekM uni fun s a | |
(GEq uni, Closed uni, Everywhere uni Eq, Eq fun, Eq ann) => Eq (Term Name uni fun ann) Source # | |
(GEq uni, Closed uni, Everywhere uni Eq, Eq fun, Eq ann) => Eq (Term DeBruijn uni fun ann) Source # | |
(GEq uni, Closed uni, Everywhere uni Eq, Eq fun, Eq ann) => Eq (Term FakeNamedDeBruijn uni fun ann) Source # | |
Defined in UntypedPlutusCore.Core.Instance.Eq Methods (==) :: Term FakeNamedDeBruijn uni fun ann -> Term FakeNamedDeBruijn uni fun ann -> Bool Source # (/=) :: Term FakeNamedDeBruijn uni fun ann -> Term FakeNamedDeBruijn uni fun ann -> Bool Source # | |
(GEq uni, Closed uni, Everywhere uni Eq, Eq fun, Eq ann) => Eq (Term NamedDeBruijn uni fun ann) Source # | |
Defined in UntypedPlutusCore.Core.Instance.Eq Methods (==) :: Term NamedDeBruijn uni fun ann -> Term NamedDeBruijn uni fun ann -> Bool Source # (/=) :: Term NamedDeBruijn uni fun ann -> Term NamedDeBruijn uni fun ann -> Bool Source # | |
(Everywhere uni Show, GShow uni, Closed uni, Show ann, Show name, Show fun) => Show (Term name uni fun ann) Source # | |
Generic (Term name uni fun ann) Source # | |
(Everywhere uni NFData, Closed uni, NFData ann, NFData name, NFData fun) => NFData (Term name uni fun ann) Source # | |
Defined in UntypedPlutusCore.Core.Type | |
(PrettyClassic name, GShow uni, Closed uni, Everywhere uni PrettyConst, Pretty fun, Pretty ann) => Pretty (Term name uni fun ann) Source # | |
Corecursive (Term name uni fun ann) | |
Defined in UntypedPlutusCore.Core.Instance.Recursive Methods embed :: Base (Term name uni fun ann) (Term name uni fun ann) -> Term name uni fun ann ana :: (a -> Base (Term name uni fun ann) a) -> a -> Term name uni fun ann apo :: (a -> Base (Term name uni fun ann) (Either (Term name uni fun ann) a)) -> a -> Term name uni fun ann postpro :: Recursive (Term name uni fun ann) => (forall b. Base (Term name uni fun ann) b -> Base (Term name uni fun ann) b) -> (a -> Base (Term name uni fun ann) a) -> a -> Term name uni fun ann gpostpro :: (Recursive (Term name uni fun ann), Monad m) => (forall b. m (Base (Term name uni fun ann) b) -> Base (Term name uni fun ann) (m b)) -> (forall c. Base (Term name uni fun ann) c -> Base (Term name uni fun ann) c) -> (a -> Base (Term name uni fun ann) (m a)) -> a -> Term name uni fun ann | |
Recursive (Term name uni fun ann) | |
Defined in UntypedPlutusCore.Core.Instance.Recursive Methods project :: Term name uni fun ann -> Base (Term name uni fun ann) (Term name uni fun ann) cata :: (Base (Term name uni fun ann) a -> a) -> Term name uni fun ann -> a para :: (Base (Term name uni fun ann) (Term name uni fun ann, a) -> a) -> Term name uni fun ann -> a gpara :: (Corecursive (Term name uni fun ann), Comonad w) => (forall b. Base (Term name uni fun ann) (w b) -> w (Base (Term name uni fun ann) b)) -> (Base (Term name uni fun ann) (EnvT (Term name uni fun ann) w a) -> a) -> Term name uni fun ann -> a prepro :: Corecursive (Term name uni fun ann) => (forall b. Base (Term name uni fun ann) b -> Base (Term name uni fun ann) b) -> (Base (Term name uni fun ann) a -> a) -> Term name uni fun ann -> a gprepro :: (Corecursive (Term name uni fun ann), Comonad w) => (forall b. Base (Term name uni fun ann) (w b) -> w (Base (Term name uni fun ann) b)) -> (forall c. Base (Term name uni fun ann) c -> Base (Term name uni fun ann) c) -> (Base (Term name uni fun ann) (w a) -> a) -> Term name uni fun ann -> a | |
(Closed uni, Everywhere uni Flat, PrettyPlc (Term name uni fun ann), Flat fun, Flat ann, Flat name, Flat (Binder name)) => Flat (Term name uni fun ann) | |
HasUniques (Term name uni fun ann) => Rename (Term name uni fun ann) Source # | |
Defined in UntypedPlutusCore.Rename | |
HasConstant (Term name uni fun ()) Source # | |
Defined in UntypedPlutusCore.Core.Type Methods asConstant :: AsUnliftingError err => Maybe cause -> Term name uni fun () -> Either (ErrorWithCause err cause) (Some (ValueOf (UniOf (Term name uni fun ())))) Source # fromConstant :: Some (ValueOf (UniOf (Term name uni fun ()))) -> Term name uni fun () Source # | |
type Rep (Term name uni fun ann) Source # | |
Defined in UntypedPlutusCore.Core.Type type Rep (Term name uni fun ann) = D1 ('MetaData "Term" "UntypedPlutusCore.Core.Type" "plutus-core-1.0.0.1-6wMiyL0yerXJu56t8zBoKx" 'False) (((C1 ('MetaCons "Var" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ann) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 name)) :+: C1 ('MetaCons "LamAbs" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ann) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 name) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Term name uni fun ann))))) :+: (C1 ('MetaCons "Apply" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ann) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Term name uni fun ann)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Term name uni fun ann)))) :+: C1 ('MetaCons "Force" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ann) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Term name uni fun ann))))) :+: ((C1 ('MetaCons "Delay" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ann) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Term name uni fun ann))) :+: C1 ('MetaCons "Constant" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ann) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Some (ValueOf uni))))) :+: (C1 ('MetaCons "Builtin" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ann) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 fun)) :+: C1 ('MetaCons "Error" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ann))))) | |
type Base (Term name uni fun ann) | |
Defined in UntypedPlutusCore.Core.Instance.Recursive | |
type UniOf (Term name uni fun ann) Source # | |
Defined in UntypedPlutusCore.Core.Type | |
type HasUniques (Term name uni fun ann) Source # | |
Defined in UntypedPlutusCore.Core.Type |
data Program name uni fun ann Source #
Constructors
Program | |
Instances
DefaultPrettyPlcStrategy (Program name uni fun ann) => PrettyBy PrettyConfigPlc (Program name uni fun ann) Source # | |
Defined in UntypedPlutusCore.Core.Instance.Pretty.Plc Methods prettyBy :: PrettyConfigPlc -> Program name uni fun ann -> Doc ann0 # prettyListBy :: PrettyConfigPlc -> [Program name uni fun ann] -> Doc ann0 # | |
PrettyReadableBy configName (Term name uni fun a) => PrettyBy (PrettyConfigReadable configName) (Program name uni fun a) Source # | |
Defined in UntypedPlutusCore.Core.Instance.Pretty.Readable Methods prettyBy :: PrettyConfigReadable configName -> Program name uni fun a -> Doc ann # prettyListBy :: PrettyConfigReadable configName -> [Program name uni fun a] -> Doc ann # | |
(PrettyClassicBy configName (Term name uni fun ann), Pretty ann) => PrettyBy (PrettyConfigClassic configName) (Program name uni fun ann) Source # | |
Defined in UntypedPlutusCore.Core.Instance.Pretty.Classic Methods prettyBy :: PrettyConfigClassic configName -> Program name uni fun ann -> Doc ann0 # prettyListBy :: PrettyConfigClassic configName -> [Program name uni fun ann] -> Doc ann0 # | |
Functor (Program name uni fun) Source # | |
(GEq uni, Closed uni, Everywhere uni Eq, Eq fun, Eq ann, Eq (Term name uni fun ann)) => Eq (Program name uni fun ann) Source # | |
(Everywhere uni Show, GShow uni, Closed uni, Show ann, Show name, Show fun) => Show (Program name uni fun ann) Source # | |
Generic (Program name uni fun ann) Source # | |
(Everywhere uni NFData, Closed uni, NFData ann, NFData name, NFData fun) => NFData (Program name uni fun ann) Source # | |
Defined in UntypedPlutusCore.Core.Type | |
(PrettyClassic name, GShow uni, Closed uni, Everywhere uni PrettyConst, Pretty fun, Pretty ann) => Pretty (Program name uni fun ann) Source # | |
(Closed uni, Everywhere uni Flat, PrettyPlc (Term name uni fun ann), Flat fun, Flat ann, Flat name, Flat (Binder name)) => Flat (Program name uni fun ann) | |
HasUniques (Program name uni fun ann) => Rename (Program name uni fun ann) Source # | |
Defined in UntypedPlutusCore.Rename | |
type Rep (Program name uni fun ann) Source # | |
Defined in UntypedPlutusCore.Core.Type type Rep (Program name uni fun ann) = D1 ('MetaData "Program" "UntypedPlutusCore.Core.Type" "plutus-core-1.0.0.1-6wMiyL0yerXJu56t8zBoKx" 'False) (C1 ('MetaCons "Program" 'PrefixI 'True) (S1 ('MetaSel ('Just "_progAnn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ann) :*: (S1 ('MetaSel ('Just "_progVer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Version ann)) :*: S1 ('MetaSel ('Just "_progTerm") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term name uni fun ann))))) | |
type HasUniques (Program name uni fun ann) Source # | |
Defined in UntypedPlutusCore.Core.Type |
applyProgram :: Program name uni fun () -> Program name uni fun () -> Program name uni fun () Source #
Take one UPLC program and apply it to another.
parseScoped :: (MonadQuote (Either (ParseErrorBundle Text ParseError)), AsUniqueError (ParseErrorBundle Text ParseError) SourcePos) => ByteString -> Either (ParseErrorBundle Text ParseError) (Program Name DefaultUni DefaultFun SourcePos) Source #
Parse and rewrite so that names are globally unique, not just unique within their scope.
data DefaultUni a Source #
The universe used by default.
Instances
data DefaultFun Source #
Default built-in functions.
When updating these, make sure to add them to the protocol version listing! See Note [New builtins and protocol versions]