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

PlutusCore.Builtin.HasConstant

Synopsis

Documentation

data BuiltinError Source #

The type of errors that readKnown and makeKnown can return.

Instances

Instances details
Show BuiltinError Source # 
Instance details

Defined in PlutusCore.Builtin.Result

Eq BuiltinError Source # 
Instance details

Defined in PlutusCore.Builtin.Result

AsBuiltinError BuiltinError Source # 
Instance details

Defined in PlutusCore.Builtin.Result

AsUnliftingEvaluationError BuiltinError Source # 
Instance details

Defined in PlutusCore.Builtin.Result

AsEvaluationFailure BuiltinError Source # 
Instance details

Defined in PlutusCore.Builtin.Result

Pretty BuiltinError Source # 
Instance details

Defined in PlutusCore.Builtin.Result

Methods

prettyBuiltinErrorDoc ann Source #

prettyList ∷ [BuiltinError] → Doc ann Source #

MonadError BuiltinError BuiltinResult Source #

throwError puts every operational unlifting error into the BuiltinFailure logs. This is to compensate for the historical lack of error message content in operational errors (structural ones don't have this problem) in our evaluators (the CK and CEK machines). It would be better to fix the underlying issue and allow operational evaluation errors to carry some form of content, but for now we just fix the symptom in order for the end user to see the error message that they are supposed to see. The fix even makes some sense: what we do here is we emulate logging when the thrown unlifting error is an operational one, i.e. this is similar to what some builtins do manually (like when a crypto builtin fails and puts info about the failure into the logs).

Instance details

Defined in PlutusCore.Builtin.Result

class HasConstant term where Source #

Ensures that term has a Constant-like constructor to lift values to and unlift values from.

Methods

asConstant ∷ term → Either BuiltinError (Some (ValueOf (UniOf term))) Source #

Unwrap from a Constant-like constructor throwing an UnliftingError if the provided term is not a wrapped Haskell value.

fromConstantSome (ValueOf (UniOf term)) → term Source #

Wrap a Haskell value as a term.

Instances

Instances details
HasConstant val ⇒ HasConstant (Opaque val rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

asConstantOpaque val rep → Either BuiltinError (Some (ValueOf (UniOf (Opaque val rep)))) Source #

fromConstantSome (ValueOf (UniOf (Opaque val rep))) → Opaque val rep Source #

HasConstant (SomeConstant uni rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

HasConstant (CkValue uni fun) Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.Ck

Methods

asConstantCkValue uni fun → Either BuiltinError (Some (ValueOf (UniOf (CkValue uni fun)))) Source #

fromConstantSome (ValueOf (UniOf (CkValue uni fun))) → CkValue uni fun Source #

HasConstant (CekValue uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

asConstantCekValue uni fun ann → Either BuiltinError (Some (ValueOf (UniOf (CekValue uni fun ann)))) Source #

fromConstantSome (ValueOf (UniOf (CekValue uni fun ann))) → CekValue uni fun ann Source #

HasConstant (Term name uni fun ()) Source # 
Instance details

Defined in UntypedPlutusCore.Core.Type

Methods

asConstantTerm name uni fun () → Either BuiltinError (Some (ValueOf (UniOf (Term name uni fun ())))) Source #

fromConstantSome (ValueOf (UniOf (Term name uni fun ()))) → Term name uni fun () Source #

HasConstant (Term TyName Name uni fun ()) Source # 
Instance details

Defined in PlutusCore.Builtin.HasConstant

Methods

asConstantTerm TyName Name uni fun () → Either BuiltinError (Some (ValueOf (UniOf (Term TyName Name uni fun ())))) Source #

fromConstantSome (ValueOf (UniOf (Term TyName Name uni fun ()))) → Term TyName Name uni fun () Source #

type HasConstantIn uni term = (UniOf term ~ uni, HasConstant term) Source #

Ensures that term has a Constant-like constructor to lift values to and unlift values from and connects term and its uni.

fromValueOf ∷ ∀ a term. HasConstant term ⇒ UniOf term (Esc a) → a → term Source #

Wrap a Haskell value (given its explicit type tag) as a term.

fromValue ∷ ∀ a term. (HasConstant term, UniOf term `HasTermLevel` a) ⇒ a → term Source #

Wrap a Haskell value (provided its type is in the universe) as a term.