| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Plutarch.Extra.Precompile
Description
Pre-compiling Plutarch functions and applying them.
Speeds up benchmarking and testing.
Synopsis
- newtype CompiledTerm (a :: S -> Type) = CompiledTerm DebuggableScript
- debuggableScript :: forall (a :: S -> Type). CompiledTerm a -> DebuggableScript
- compile' :: forall (a :: S -> Type). (forall (s :: S). Term s a) -> CompiledTerm a
- toDebuggableScript :: forall (a :: S -> Type). CompiledTerm a -> DebuggableScript
- applyCompiledTerm :: forall (a :: S -> Type) (b :: S -> Type). CompiledTerm (a :--> b) -> (forall (s :: S). Term s a) -> CompiledTerm b
- applyCompiledTerm' :: forall (a :: S -> Type) (b :: S -> Type). CompiledTerm (a :--> b) -> (forall (s :: S). Term s a) -> CompiledTerm b
- applyCompiledTerm2 :: forall (a :: S -> Type) (b :: S -> Type). CompiledTerm (a :--> b) -> CompiledTerm a -> CompiledTerm b
- applyCompiledTerm2' :: forall (a :: S -> Type) (b :: S -> Type). CompiledTerm (a :--> b) -> CompiledTerm a -> CompiledTerm b
- (##) :: forall (a :: S -> Type) (b :: S -> Type). CompiledTerm (a :--> b) -> (forall (s :: S). Term s a) -> CompiledTerm b
- (##~) :: forall (a :: S -> Type) (b :: S -> Type). CompiledTerm (a :--> b) -> (forall (s :: S). Term s a) -> CompiledTerm b
- (###) :: forall (a :: S -> Type) (b :: S -> Type). CompiledTerm (a :--> b) -> CompiledTerm a -> CompiledTerm b
- (###~) :: forall (a :: S -> Type) (b :: S -> Type). CompiledTerm (a :--> b) -> CompiledTerm a -> CompiledTerm b
- pliftCompiled' :: forall (p :: S -> Type). PUnsafeLiftDecl p => CompiledTerm p -> Either (LiftError, [Text]) (PLifted p)
- pliftCompiled :: forall (p :: S -> Type). (HasCallStack, PLift p) => CompiledTerm p -> PLifted p
Documentation
newtype CompiledTerm (a :: S -> Type) Source #
Type-safe wrapper for compiled Plutarch functions.
Since: 3.8.0
Constructors
| CompiledTerm DebuggableScript |
debuggableScript :: forall (a :: S -> Type). CompiledTerm a -> DebuggableScript Source #
Since: 3.8.0
compile' :: forall (a :: S -> Type). (forall (s :: S). Term s a) -> CompiledTerm a Source #
Compile a closed Plutarch Term to a CompiledTerm.
Beware, the Script inside contains everything it needs. You can end up with
multiple copies of the same helper function through compiled terms (including
RHS terms compiled by ## and ##~).
Since: 3.0.2
toDebuggableScript :: forall (a :: S -> Type). CompiledTerm a -> DebuggableScript Source #
Convert a CompiledTerm to a Script.
Since: 3.0.2
applyCompiledTerm :: forall (a :: S -> Type) (b :: S -> Type). CompiledTerm (a :--> b) -> (forall (s :: S). Term s a) -> CompiledTerm b Source #
Apply a CompiledTerm to a closed Plutarch Term.
Evaluates the argument before applying. You want this for benchmarking the compiled function. Helps to avoid tainting the measurement by input conversions.
Since: 3.0.2
applyCompiledTerm' :: forall (a :: S -> Type) (b :: S -> Type). CompiledTerm (a :--> b) -> (forall (s :: S). Term s a) -> CompiledTerm b Source #
Apply a CompiledTerm to a closed Plutarch Term.
Does NOT evaluate the argument before applying. Using this seems to save very little overhead, not worth it for efficiency. Only use it to make argument evaluation count for benchmarking.
Since: 3.0.2
applyCompiledTerm2 :: forall (a :: S -> Type) (b :: S -> Type). CompiledTerm (a :--> b) -> CompiledTerm a -> CompiledTerm b Source #
Apply a CompiledTerm to a CompiledTerm.
Evaluates the argument before applying. You want this for benchmarking the compiled function. Helps to avoid tainting the measurement by input conversions.
Since: 3.0.2
applyCompiledTerm2' :: forall (a :: S -> Type) (b :: S -> Type). CompiledTerm (a :--> b) -> CompiledTerm a -> CompiledTerm b Source #
Apply a CompiledTerm to a CompiledTerm.
Does NOT evaluate the argument before applying. Using this seems to save very little overhead, not worth it for efficiency. Only use it to make argument evaluation count for benchmarking.
Since: 3.0.2
(##) :: forall (a :: S -> Type) (b :: S -> Type). CompiledTerm (a :--> b) -> (forall (s :: S). Term s a) -> CompiledTerm b infixl 8 Source #
Alias for applyCompiledTerm.
Since: 3.0.2
(##~) :: forall (a :: S -> Type) (b :: S -> Type). CompiledTerm (a :--> b) -> (forall (s :: S). Term s a) -> CompiledTerm b infixl 8 Source #
Alias for 'applyCompiledTerm''.
Since: 3.0.2
(###) :: forall (a :: S -> Type) (b :: S -> Type). CompiledTerm (a :--> b) -> CompiledTerm a -> CompiledTerm b infixl 7 Source #
Alias for applyCompiledTerm2.
Since: 3.0.2
(###~) :: forall (a :: S -> Type) (b :: S -> Type). CompiledTerm (a :--> b) -> CompiledTerm a -> CompiledTerm b infixl 7 Source #
Alias for 'applyCompiledTerm2''.
Since: 3.0.2
pliftCompiled' :: forall (p :: S -> Type). PUnsafeLiftDecl p => CompiledTerm p -> Either (LiftError, [Text]) (PLifted p) Source #
Convert a CompiledTerm to the associated Haskell value. Fail otherwise.
This will fully evaluate the compiled term, and convert the resulting value.
Since: 3.0.2
pliftCompiled :: forall (p :: S -> Type). (HasCallStack, PLift p) => CompiledTerm p -> PLifted p Source #
Like pliftCompiled` but throws on failure.
Since: 3.0.2