plutus-tx-1.45.0.0: Libraries for Plutus Tx and its prelude
Safe HaskellSafe-Inferred
LanguageHaskell2010

PlutusTx.Lift

Synopsis
  • safeLiftWith :: forall a e uni fun m. (Lift uni a, AsTypeError e (Term TyName Name uni fun ()) uni fun (Provenance ()), GEq uni, AsTypeErrorExt e uni (Provenance ()), AsFreeVariableError e, AsError e uni fun (Provenance ()), MonadError e m, MonadQuote m, Typecheckable uni fun, PrettyUni uni, Pretty fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => (CompilationOpts () -> CompilationOpts ()) -> (CompilationOpts Name fun (Provenance ()) -> CompilationOpts Name fun (Provenance ())) -> Version -> a -> m (Term TyName Name uni fun (), Term NamedDeBruijn uni fun ())
  • safeLift :: forall a e uni fun m. (Lift uni a, AsTypeError e (Term TyName Name uni fun ()) uni fun (Provenance ()), GEq uni, AsTypeErrorExt e uni (Provenance ()), AsFreeVariableError e, AsError e uni fun (Provenance ()), MonadError e m, MonadQuote m, Typecheckable uni fun, PrettyUni uni, Pretty fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> m (Term TyName Name uni fun (), Term NamedDeBruijn uni fun ())
  • safeLiftUnopt :: forall a e uni fun m. (Lift uni a, AsTypeError e (Term TyName Name uni fun ()) uni fun (Provenance ()), GEq uni, AsTypeErrorExt e uni (Provenance ()), AsFreeVariableError e, AsError e uni fun (Provenance ()), MonadError e m, MonadQuote m, Typecheckable uni fun, PrettyUni uni, Pretty fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> m (Term TyName Name uni fun (), Term NamedDeBruijn uni fun ())
  • safeLiftProgram :: (Lift uni a, AsTypeError e (Term TyName Name uni fun ()) uni fun (Provenance ()), GEq uni, AsTypeErrorExt e uni (Provenance ()), AsFreeVariableError e, AsError e uni fun (Provenance ()), MonadError e m, MonadQuote m, Typecheckable uni fun, PrettyUni uni, Pretty fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> m (Program TyName Name uni fun (), Program NamedDeBruijn uni fun ())
  • safeLiftProgramUnopt :: (Lift uni a, AsTypeError e (Term TyName Name uni fun ()) uni fun (Provenance ()), GEq uni, AsTypeErrorExt e uni (Provenance ()), AsFreeVariableError e, AsError e uni fun (Provenance ()), MonadError e m, MonadQuote m, Typecheckable uni fun, PrettyUni uni, Pretty fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> m (Program TyName Name uni fun (), Program NamedDeBruijn uni fun ())
  • safeLiftCode :: (Lift uni a, AsTypeError e (Term TyName Name uni fun ()) uni fun (Provenance ()), GEq uni, AsTypeErrorExt e uni (Provenance ()), AsFreeVariableError e, AsError e uni fun (Provenance ()), MonadError e m, MonadQuote m, Typecheckable uni fun, PrettyUni uni, Pretty fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> m (CompiledCodeIn uni fun a)
  • safeLiftCodeUnopt :: (Lift uni a, AsTypeError e (Term TyName Name uni fun ()) uni fun (Provenance ()), GEq uni, AsTypeErrorExt e uni (Provenance ()), AsFreeVariableError e, AsError e uni fun (Provenance ()), MonadError e m, MonadQuote m, Typecheckable uni fun, PrettyUni uni, Pretty fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> m (CompiledCodeIn uni fun a)
  • lift :: (Lift uni a, ThrowableBuiltins uni fun, Typecheckable uni fun, GEq uni, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> (Term TyName Name uni fun (), Term NamedDeBruijn uni fun ())
  • liftUnopt :: (Lift uni a, ThrowableBuiltins uni fun, Typecheckable uni fun, GEq uni, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> (Term TyName Name uni fun (), Term NamedDeBruijn uni fun ())
  • liftProgram :: (Lift uni a, ThrowableBuiltins uni fun, Typecheckable uni fun, GEq uni, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> (Program TyName Name uni fun (), Program NamedDeBruijn uni fun ())
  • liftProgramUnopt :: (Lift uni a, ThrowableBuiltins uni fun, Typecheckable uni fun, GEq uni, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> (Program TyName Name uni fun (), Program NamedDeBruijn uni fun ())
  • liftProgramDef :: Lift DefaultUni a => a -> (Program TyName Name DefaultUni DefaultFun (), Program NamedDeBruijn DefaultUni DefaultFun ())
  • liftProgramDefUnopt :: Lift DefaultUni a => a -> (Program TyName Name DefaultUni DefaultFun (), Program NamedDeBruijn DefaultUni DefaultFun ())
  • liftCode :: (Lift uni a, GEq uni, ThrowableBuiltins uni fun, Typecheckable uni fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> CompiledCodeIn uni fun a
  • liftCodeUnopt :: (Lift uni a, GEq uni, ThrowableBuiltins uni fun, Typecheckable uni fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> CompiledCodeIn uni fun a
  • liftCodeDef :: (Lift uni a, GEq uni, ThrowableBuiltins uni fun, Typecheckable uni fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => a -> CompiledCodeIn uni fun a
  • liftCodeDefUnopt :: (Lift uni a, GEq uni, ThrowableBuiltins uni fun, Typecheckable uni fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => a -> CompiledCodeIn uni fun a
  • typeCheckAgainst :: forall e a uni fun m. (Typeable uni a, AsTypeError e (Term TyName Name uni fun ()) uni fun (Provenance ()), AsTypeErrorExt e uni (Provenance ()), AsError e uni fun (Provenance ()), MonadError e m, MonadQuote m, GEq uni, Typecheckable uni fun, PrettyUni uni, Pretty fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun)) => Proxy a -> Program TyName Name uni fun () -> m ()
  • typeCode :: forall e a uni fun m. (Typeable uni a, AsTypeError e (Term TyName Name uni fun ()) uni fun (Provenance ()), AsTypeErrorExt e uni (Provenance ()), AsFreeVariableError e, AsError e uni fun (Provenance ()), MonadError e m, MonadQuote m, GEq uni, Typecheckable uni fun, PrettyUni uni, Pretty fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Proxy a -> Program TyName Name uni fun () -> m (CompiledCodeIn uni fun a)
  • makeTypeable :: Type -> Name -> Q [Dec]
  • makeLift :: Name -> Q [Dec]
  • data LiftError

Documentation

safeLiftWith Source #

Arguments

:: forall a e uni fun m. (Lift uni a, AsTypeError e (Term TyName Name uni fun ()) uni fun (Provenance ()), GEq uni, AsTypeErrorExt e uni (Provenance ()), AsFreeVariableError e, AsError e uni fun (Provenance ()), MonadError e m, MonadQuote m, Typecheckable uni fun, PrettyUni uni, Pretty fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) 
=> (CompilationOpts () -> CompilationOpts ())

Modifier of PIR compilation options

-> (CompilationOpts Name fun (Provenance ()) -> CompilationOpts Name fun (Provenance ()))

Modifier of UPLC compilation options

-> Version 
-> a 
-> m (Term TyName Name uni fun (), Term NamedDeBruijn uni fun ()) 

Get a Plutus Core term corresponding to the given value. Allows configuring PIR and UPLC optimization options.

safeLift :: forall a e uni fun m. (Lift uni a, AsTypeError e (Term TyName Name uni fun ()) uni fun (Provenance ()), GEq uni, AsTypeErrorExt e uni (Provenance ()), AsFreeVariableError e, AsError e uni fun (Provenance ()), MonadError e m, MonadQuote m, Typecheckable uni fun, PrettyUni uni, Pretty fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> m (Term TyName Name uni fun (), Term NamedDeBruijn uni fun ()) Source #

Get a Plutus Core term corresponding to the given value, applying default PIR/UPLC optimizations.

safeLiftUnopt :: forall a e uni fun m. (Lift uni a, AsTypeError e (Term TyName Name uni fun ()) uni fun (Provenance ()), GEq uni, AsTypeErrorExt e uni (Provenance ()), AsFreeVariableError e, AsError e uni fun (Provenance ()), MonadError e m, MonadQuote m, Typecheckable uni fun, PrettyUni uni, Pretty fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> m (Term TyName Name uni fun (), Term NamedDeBruijn uni fun ()) Source #

Like safeLift but does not apply PIR/UPLC optimizations. Use this option where lifting speed is more important than optimal code.

safeLiftProgram :: (Lift uni a, AsTypeError e (Term TyName Name uni fun ()) uni fun (Provenance ()), GEq uni, AsTypeErrorExt e uni (Provenance ()), AsFreeVariableError e, AsError e uni fun (Provenance ()), MonadError e m, MonadQuote m, Typecheckable uni fun, PrettyUni uni, Pretty fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> m (Program TyName Name uni fun (), Program NamedDeBruijn uni fun ()) Source #

Get a Plutus Core program corresponding to the given value, applying default PIR/UPLC optimizations.

safeLiftProgramUnopt :: (Lift uni a, AsTypeError e (Term TyName Name uni fun ()) uni fun (Provenance ()), GEq uni, AsTypeErrorExt e uni (Provenance ()), AsFreeVariableError e, AsError e uni fun (Provenance ()), MonadError e m, MonadQuote m, Typecheckable uni fun, PrettyUni uni, Pretty fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> m (Program TyName Name uni fun (), Program NamedDeBruijn uni fun ()) Source #

Like safeLiftProgram but does not apply PIR/UPLC optimizations. Use this option where lifting speed is more important than optimal code.

safeLiftCode :: (Lift uni a, AsTypeError e (Term TyName Name uni fun ()) uni fun (Provenance ()), GEq uni, AsTypeErrorExt e uni (Provenance ()), AsFreeVariableError e, AsError e uni fun (Provenance ()), MonadError e m, MonadQuote m, Typecheckable uni fun, PrettyUni uni, Pretty fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> m (CompiledCodeIn uni fun a) Source #

safeLiftCodeUnopt :: (Lift uni a, AsTypeError e (Term TyName Name uni fun ()) uni fun (Provenance ()), GEq uni, AsTypeErrorExt e uni (Provenance ()), AsFreeVariableError e, AsError e uni fun (Provenance ()), MonadError e m, MonadQuote m, Typecheckable uni fun, PrettyUni uni, Pretty fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> m (CompiledCodeIn uni fun a) Source #

Like safeLiftCode but does not apply PIR/UPLC optimizations. Use this option where lifting speed is more important than optimal code.

lift :: (Lift uni a, ThrowableBuiltins uni fun, Typecheckable uni fun, GEq uni, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> (Term TyName Name uni fun (), Term NamedDeBruijn uni fun ()) Source #

Get a Plutus Core term corresponding to the given value, throwing any errors that occur as exceptions and ignoring fresh names. The default PIR/UPLC optimizations are applied.

liftUnopt :: (Lift uni a, ThrowableBuiltins uni fun, Typecheckable uni fun, GEq uni, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> (Term TyName Name uni fun (), Term NamedDeBruijn uni fun ()) Source #

Like lift but does not apply PIR/UPLC optimizations. Use this option where lifting speed is more important than optimal code.

liftProgram :: (Lift uni a, ThrowableBuiltins uni fun, Typecheckable uni fun, GEq uni, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> (Program TyName Name uni fun (), Program NamedDeBruijn uni fun ()) Source #

Get a Plutus Core program corresponding to the given value, throwing any errors that occur as exceptions and ignoring fresh names.

liftProgramUnopt :: (Lift uni a, ThrowableBuiltins uni fun, Typecheckable uni fun, GEq uni, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> (Program TyName Name uni fun (), Program NamedDeBruijn uni fun ()) Source #

Like liftProgram but does not apply PIR/UPLC optimizations. Use this option where lifting speed is more important than optimal code.

liftProgramDef :: Lift DefaultUni a => a -> (Program TyName Name DefaultUni DefaultFun (), Program NamedDeBruijn DefaultUni DefaultFun ()) Source #

Get a Plutus Core program in the default universe with the default version, corresponding to the given value, throwing any errors that occur as exceptions and ignoring fresh names.

liftProgramDefUnopt :: Lift DefaultUni a => a -> (Program TyName Name DefaultUni DefaultFun (), Program NamedDeBruijn DefaultUni DefaultFun ()) Source #

Like liftProgramDef but does not apply PIR/UPLC optimizations. Use this option where lifting speed is more important than optimal code.

liftCode :: (Lift uni a, GEq uni, ThrowableBuiltins uni fun, Typecheckable uni fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> CompiledCodeIn uni fun a Source #

Get a Plutus Core program corresponding to the given value as a CompiledCodeIn, throwing any errors that occur as exceptions and ignoring fresh names.

liftCodeUnopt :: (Lift uni a, GEq uni, ThrowableBuiltins uni fun, Typecheckable uni fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> CompiledCodeIn uni fun a Source #

Like liftCode but does not apply PIR/UPLC optimizations. Use this option where lifting speed is more important than optimal code.

liftCodeDef :: (Lift uni a, GEq uni, ThrowableBuiltins uni fun, Typecheckable uni fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => a -> CompiledCodeIn uni fun a Source #

Get a Plutus Core program with the default version, corresponding to the given value as a CompiledCodeIn, throwing any errors that occur as exceptions and ignoring fresh names.

liftCodeDefUnopt :: (Lift uni a, GEq uni, ThrowableBuiltins uni fun, Typecheckable uni fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => a -> CompiledCodeIn uni fun a Source #

Like liftCodeDef but does not apply PIR/UPLC optimizations. Use this option where lifting speed is more important than optimal code.

typeCheckAgainst :: forall e a uni fun m. (Typeable uni a, AsTypeError e (Term TyName Name uni fun ()) uni fun (Provenance ()), AsTypeErrorExt e uni (Provenance ()), AsError e uni fun (Provenance ()), MonadError e m, MonadQuote m, GEq uni, Typecheckable uni fun, PrettyUni uni, Pretty fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun)) => Proxy a -> Program TyName Name uni fun () -> m () Source #

Check that PLC term has the given type.

typeCode :: forall e a uni fun m. (Typeable uni a, AsTypeError e (Term TyName Name uni fun ()) uni fun (Provenance ()), AsTypeErrorExt e uni (Provenance ()), AsFreeVariableError e, AsError e uni fun (Provenance ()), MonadError e m, MonadQuote m, GEq uni, Typecheckable uni fun, PrettyUni uni, Pretty fun, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Proxy a -> Program TyName Name uni fun () -> m (CompiledCodeIn uni fun a) Source #

Try to interpret a PLC program as a CompiledCodeIn of the given type. Returns successfully iff the program has the right type.