plutus-tx
Safe HaskellNone
LanguageHaskell2010

PlutusTx.Lift

Synopsis
  • safeLiftWith :: forall a (uni :: Type -> Type) fun m. (Lift uni a, GEq uni, Everywhere uni Eq, MonadError (Error uni fun (Provenance ())) m, MonadQuote m, Typecheckable uni fun, CaseBuiltin uni, 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 (uni :: Type -> Type) fun m. (Lift uni a, GEq uni, Everywhere uni Eq, MonadError (Error uni fun (Provenance ())) m, MonadQuote m, Typecheckable uni fun, CaseBuiltin uni, 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 (uni :: Type -> Type) fun m. (Lift uni a, GEq uni, Everywhere uni Eq, MonadError (Error uni fun (Provenance ())) m, MonadQuote m, Typecheckable uni fun, CaseBuiltin uni, 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 :: forall (uni :: Type -> Type) a fun m. (Lift uni a, GEq uni, Everywhere uni Eq, MonadError (Error uni fun (Provenance ())) m, MonadQuote m, Typecheckable uni fun, CaseBuiltin uni, 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 :: forall (uni :: Type -> Type) a fun m. (Lift uni a, GEq uni, Everywhere uni Eq, MonadError (Error uni fun (Provenance ())) m, MonadQuote m, Typecheckable uni fun, CaseBuiltin uni, 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 :: forall (uni :: Type -> Type) a fun m. (Lift uni a, GEq uni, Everywhere uni Eq, MonadError (Error uni fun (Provenance ())) m, MonadQuote m, Typecheckable uni fun, CaseBuiltin uni, 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 :: forall (uni :: Type -> Type) a fun m. (Lift uni a, GEq uni, Everywhere uni Eq, MonadError (Error uni fun (Provenance ())) m, MonadQuote m, Typecheckable uni fun, CaseBuiltin uni, 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 :: forall (uni :: Type -> Type) a fun. (Lift uni a, ThrowableBuiltins uni fun, Typecheckable uni fun, GEq uni, Everywhere uni Eq, CaseBuiltin 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 :: forall (uni :: Type -> Type) a fun. (Lift uni a, ThrowableBuiltins uni fun, Typecheckable uni fun, GEq uni, Everywhere uni Eq, CaseBuiltin 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 :: forall (uni :: Type -> Type) a fun. (Lift uni a, ThrowableBuiltins uni fun, Typecheckable uni fun, GEq uni, Everywhere uni Eq, CaseBuiltin 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 :: forall (uni :: Type -> Type) a fun. (Lift uni a, ThrowableBuiltins uni fun, Typecheckable uni fun, GEq uni, Everywhere uni Eq, CaseBuiltin 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 :: forall (uni :: Type -> Type) a fun. (Lift uni a, GEq uni, Everywhere uni Eq, ThrowableBuiltins uni fun, Typecheckable uni fun, CaseBuiltin uni, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> CompiledCodeIn uni fun a
  • liftCodeUnopt :: forall (uni :: Type -> Type) a fun. (Lift uni a, GEq uni, Everywhere uni Eq, ThrowableBuiltins uni fun, Typecheckable uni fun, CaseBuiltin uni, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => Version -> a -> CompiledCodeIn uni fun a
  • liftCodeDef :: forall (uni :: Type -> Type) a fun. (Lift uni a, GEq uni, Everywhere uni Eq, ThrowableBuiltins uni fun, Typecheckable uni fun, CaseBuiltin uni, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => a -> CompiledCodeIn uni fun a
  • liftCodeDefUnopt :: forall (uni :: Type -> Type) a fun. (Lift uni a, GEq uni, Everywhere uni Eq, ThrowableBuiltins uni fun, Typecheckable uni fun, CaseBuiltin uni, Default (CostingPart uni fun), Default (BuiltinsInfo uni fun), Default (RewriteRules uni fun), Hashable fun) => a -> CompiledCodeIn uni fun a
  • typeCheckAgainst :: forall a (uni :: Type -> Type) fun m. (Typeable uni a, MonadError (Error uni fun (Provenance ())) m, MonadQuote m, GEq uni, Typecheckable uni fun, CaseBuiltin uni, 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 a (uni :: Type -> Type) fun m. (Typeable uni a, MonadError (Error uni fun (Provenance ())) m, MonadQuote m, GEq uni, Everywhere uni Eq, Typecheckable uni fun, CaseBuiltin uni, 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 (uni :: Type -> Type) fun m. (Lift uni a, GEq uni, Everywhere uni Eq, MonadError (Error uni fun (Provenance ())) m, MonadQuote m, Typecheckable uni fun, CaseBuiltin uni, 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 (uni :: Type -> Type) fun m. (Lift uni a, GEq uni, Everywhere uni Eq, MonadError (Error uni fun (Provenance ())) m, MonadQuote m, Typecheckable uni fun, CaseBuiltin uni, 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 (uni :: Type -> Type) fun m. (Lift uni a, GEq uni, Everywhere uni Eq, MonadError (Error uni fun (Provenance ())) m, MonadQuote m, Typecheckable uni fun, CaseBuiltin uni, 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 :: forall (uni :: Type -> Type) a fun m. (Lift uni a, GEq uni, Everywhere uni Eq, MonadError (Error uni fun (Provenance ())) m, MonadQuote m, Typecheckable uni fun, CaseBuiltin uni, 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 :: forall (uni :: Type -> Type) a fun m. (Lift uni a, GEq uni, Everywhere uni Eq, MonadError (Error uni fun (Provenance ())) m, MonadQuote m, Typecheckable uni fun, CaseBuiltin uni, 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 :: forall (uni :: Type -> Type) a fun m. (Lift uni a, GEq uni, Everywhere uni Eq, MonadError (Error uni fun (Provenance ())) m, MonadQuote m, Typecheckable uni fun, CaseBuiltin uni, 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 :: forall (uni :: Type -> Type) a fun m. (Lift uni a, GEq uni, Everywhere uni Eq, MonadError (Error uni fun (Provenance ())) m, MonadQuote m, Typecheckable uni fun, CaseBuiltin uni, 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 :: forall (uni :: Type -> Type) a fun. (Lift uni a, ThrowableBuiltins uni fun, Typecheckable uni fun, GEq uni, Everywhere uni Eq, CaseBuiltin 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 :: forall (uni :: Type -> Type) a fun. (Lift uni a, ThrowableBuiltins uni fun, Typecheckable uni fun, GEq uni, Everywhere uni Eq, CaseBuiltin 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 :: forall (uni :: Type -> Type) a fun. (Lift uni a, ThrowableBuiltins uni fun, Typecheckable uni fun, GEq uni, Everywhere uni Eq, CaseBuiltin 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 :: forall (uni :: Type -> Type) a fun. (Lift uni a, ThrowableBuiltins uni fun, Typecheckable uni fun, GEq uni, Everywhere uni Eq, CaseBuiltin 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 :: forall (uni :: Type -> Type) a fun. (Lift uni a, GEq uni, Everywhere uni Eq, ThrowableBuiltins uni fun, Typecheckable uni fun, CaseBuiltin uni, 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 :: forall (uni :: Type -> Type) a fun. (Lift uni a, GEq uni, Everywhere uni Eq, ThrowableBuiltins uni fun, Typecheckable uni fun, CaseBuiltin uni, 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 :: forall (uni :: Type -> Type) a fun. (Lift uni a, GEq uni, Everywhere uni Eq, ThrowableBuiltins uni fun, Typecheckable uni fun, CaseBuiltin uni, 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 :: forall (uni :: Type -> Type) a fun. (Lift uni a, GEq uni, Everywhere uni Eq, ThrowableBuiltins uni fun, Typecheckable uni fun, CaseBuiltin uni, 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 a (uni :: Type -> Type) fun m. (Typeable uni a, MonadError (Error uni fun (Provenance ())) m, MonadQuote m, GEq uni, Typecheckable uni fun, CaseBuiltin uni, 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 a (uni :: Type -> Type) fun m. (Typeable uni a, MonadError (Error uni fun (Provenance ())) m, MonadQuote m, GEq uni, Everywhere uni Eq, Typecheckable uni fun, CaseBuiltin uni, 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.

makeTypeable :: Type -> Name -> Q [Dec] Source #

Given a universe, derive a Typeable instance for a given Plinth datatype

NOTE: it requires MultiParamTypeClasses language extension

makeLift :: Name -> Q [Dec] Source #

Derive Lift and Typeable instances for Plinth types

NOTE: it requires MultiParamTypeClasses,FlexibleContexts language extensions