Safe Haskell | None |
---|---|
Language | Haskell2010 |
UntypedPlutusCore.Core.Type
Synopsis
- type family UniOf a :: Type -> Type
- data Version ann = Version ann Natural Natural Natural
- newtype Binder name = Binder {
- unBinder :: name
- data Term name uni fun ann
- data Program name uni fun ann = Program {}
- progAnn :: forall name uni fun ann. Lens' (Program name uni fun ann) ann
- progVer :: forall name uni fun ann. Lens' (Program name uni fun ann) (Version ann)
- progTerm :: forall name uni fun ann name uni fun. Lens (Program name uni fun ann) (Program name uni fun ann) (Term name uni fun ann) (Term name uni fun ann)
- bindFunM :: Monad m => (ann -> fun -> m (Term name uni fun' ann)) -> Term name uni fun ann -> m (Term name uni fun' ann)
- bindFun :: (ann -> fun -> Term name uni fun' ann) -> Term name uni fun ann -> Term name uni fun' ann
- mapFun :: (ann -> fun -> fun') -> Term name uni fun ann -> Term name uni fun' ann
- termAnn :: Term name uni fun ann -> ann
- erase :: Term tyname name uni fun ann -> Term name uni fun ann
- eraseProgram :: Program tyname name uni fun ann -> Program name uni fun ann
- data UVarDecl name ann = UVarDecl {
- _uvarDeclAnn :: ann
- _uvarDeclName :: name
- uvarDeclName :: forall name ann name. Lens (UVarDecl name ann) (UVarDecl name ann) name name
- uvarDeclAnn :: forall name ann ann. Lens (UVarDecl name ann) (UVarDecl name ann) ann ann
Documentation
type family UniOf a :: Type -> Type Source #
Extract the universe from a type.
Instances
type UniOf (Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.Polymorphism | |
type UniOf (CkValue uni fun) Source # | |
Defined in PlutusCore.Evaluation.Machine.Ck | |
type UniOf (CekValue uni fun) Source # | |
type UniOf (Term name uni fun ann) Source # | |
Defined in UntypedPlutusCore.Core.Type | |
type UniOf (Term tyname name uni fun ann) Source # | |
Defined in PlutusCore.Core.Type | |
type UniOf (Term tyname name uni fun ann) Source # | |
Defined in PlutusIR.Core.Type |
Version of Plutus Core to be used for the program.
Instances
This is a wrapper to mark the place where the binder is introduced (i.e. LamAbs/TyAbs)
and not where it is actually used (TyVar/Var..).
This marking allows us to skip the (de)serialization of binders at LamAbs/TyAbs positions
iff name
is DeBruijn-encoded (level or index). See for example the instance of Flat
Instances
Flat (Binder TyName) | |
Flat (Binder Name) | |
Flat (Binder NamedTyDeBruijn) | |
Defined in PlutusCore.Flat Methods encode :: Binder NamedTyDeBruijn -> Encoding decode :: Get (Binder NamedTyDeBruijn) size :: Binder NamedTyDeBruijn -> NumBits -> NumBits | |
Flat (Binder DeBruijn) | |
Flat (Binder FakeNamedDeBruijn) | |
Defined in PlutusCore.Flat Methods encode :: Binder FakeNamedDeBruijn -> Encoding decode :: Get (Binder FakeNamedDeBruijn) size :: Binder FakeNamedDeBruijn -> NumBits -> NumBits | |
Flat (Binder NamedDeBruijn) | |
Defined in PlutusCore.Flat Methods encode :: Binder NamedDeBruijn -> Encoding decode :: Get (Binder NamedDeBruijn) size :: Binder NamedDeBruijn -> NumBits -> NumBits |
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 |
progTerm :: forall name uni fun ann name uni fun. Lens (Program name uni fun ann) (Program name uni fun ann) (Term name uni fun ann) (Term name uni fun ann) Source #
bindFunM :: Monad m => (ann -> fun -> m (Term name uni fun' ann)) -> Term name uni fun ann -> m (Term name uni fun' ann) Source #
bindFun :: (ann -> fun -> Term name uni fun' ann) -> Term name uni fun ann -> Term name uni fun' ann Source #
erase :: Term tyname name uni fun ann -> Term name uni fun ann Source #
Erase a Typed Plutus Core term to its untyped counterpart.
eraseProgram :: Program tyname name uni fun ann -> Program name uni fun ann Source #
Erase a Typed Plutus Core Program to its untyped counterpart.
data UVarDecl name ann Source #
An untyped "variable declaration", i.e. a name for a variable.
Constructors
UVarDecl | |
Fields
|
Instances
Functor (UVarDecl name) Source # | |
(Show ann, Show name) => Show (UVarDecl name ann) Source # | |
Generic (UVarDecl name ann) Source # | |
type Rep (UVarDecl name ann) Source # | |
Defined in UntypedPlutusCore.Core.Type type Rep (UVarDecl name ann) = D1 ('MetaData "UVarDecl" "UntypedPlutusCore.Core.Type" "plutus-core-1.0.0.1-6wMiyL0yerXJu56t8zBoKx" 'False) (C1 ('MetaCons "UVarDecl" 'PrefixI 'True) (S1 ('MetaSel ('Just "_uvarDeclAnn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ann) :*: S1 ('MetaSel ('Just "_uvarDeclName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 name))) |
uvarDeclName :: forall name ann name. Lens (UVarDecl name ann) (UVarDecl name ann) name name Source #
uvarDeclAnn :: forall name ann ann. Lens (UVarDecl name ann) (UVarDecl name ann) ann ann Source #