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

PlutusCore.Generators.Hedgehog.Entity

Description

Generators of various PLC things: Builtins, IterApps, Terms, etc.

Synopsis

Documentation

type PlcGenT uni fun m = GenT (ReaderT (BuiltinGensT uni fun m) m) Source #

The type used in generators defined in this module. It's parameterized by a BuiltinGensT which makes it possible to supply different generators of built-in types. For example, genTypedBuiltinDiv never generates a zero, so this generator can be used in order to avoid the divide-by-zero-induced error. Supplied generators are of arbitrary complexity and can call the currently running generator recursively, for example.

data IterApp head arg Source #

A function (called "head") applied to a list of arguments (called "spine").

Constructors

IterApp 

Fields

Instances

Instances details
(PrettyBy config head, PrettyBy config arg) ⇒ PrettyBy config (IterApp head arg) Source # 
Instance details

Defined in PlutusCore.Generators.Hedgehog.Entity

Methods

prettyBy ∷ config → IterApp head arg → Doc ann Source #

prettyListBy ∷ config → [IterApp head arg] → Doc ann Source #

data IterAppValue uni fun head arg r Source #

One iterated application of a head to args represented in three distinct ways.

Constructors

IterAppValue 

Fields

Instances

Instances details
(PrettyBy config (Plain Term uni fun), PrettyBy config head, PrettyBy config arg, PrettyConst r) ⇒ PrettyBy config (IterAppValue uni fun head arg r) Source # 
Instance details

Defined in PlutusCore.Generators.Hedgehog.Entity

Methods

prettyBy ∷ config → IterAppValue uni fun head arg r → Doc ann Source #

prettyListBy ∷ config → [IterAppValue uni fun head arg r] → Doc ann Source #

runPlcTMonad m ⇒ TypedBuiltinGenT (Plain Term uni fun) m → PlcGenT uni fun m a → GenT m a Source #

Run a PlcGenT computation by supplying built-ins generators.

withTypedBuiltinGenMonad m ⇒ Proxy fun → (∀ a. (KnownTypeAst TyName DefaultUni a, MakeKnown (Plain Term DefaultUni fun) a) ⇒ TypeRep a → GenT m c) → GenT m c Source #

Generate a Builtin and supply its typed version to a continuation.

genIterAppValue ∷ ∀ head uni fun res m. Monad m ⇒ Denotation (Plain Term uni fun) head res → PlcGenT uni fun m (IterAppValue uni fun head (Plain Term uni fun) res) Source #

Generate an IterAppValue from a Denotation. If the Denotation has a functional type, then all arguments are generated and supplied to the denotation. Since IterAppValue consists of three components, we 1. grow the Term component by applying it to arguments using Apply 2. grow the IterApp component by appending arguments to its spine 3. feed arguments to the Haskell function

genTerm Source #

Arguments

∷ ∀ uni fun m. (uni ~ DefaultUni, Monad m) 
TypedBuiltinGenT (Plain Term uni fun) m

Ground generators of built-ins. The base case of the recursion.

DenotationContext (Plain Term uni fun)

A context to generate terms in. See for example typedBuiltins. Gets extended by a variable when an applied lambda is generated.

Int

Depth of recursion.

TypedBuiltinGenT (Plain Term uni fun) m 

Generate a PLC Term of the specified type and the corresponding Haskell value. Generates first-order functions and constants including constant applications. Arguments to functions and Builtins are generated recursively.

genTermLooseMonad m ⇒ TypedBuiltinGenT (Plain Term DefaultUni DefaultFun) m Source #

Generates a Term with rather small values to make out-of-bounds failures less likely. There are still like a half of terms that fail with out-of-bounds errors being evaluated.

withAnyTermLoose ∷ (uni ~ DefaultUni, fun ~ DefaultFun, Monad m) ⇒ (∀ a. KnownType (Plain Term uni fun) a ⇒ TermOf (Plain Term uni fun) a → GenT m c) → GenT m c Source #

Generate a TypedBuiltin and a TermOf of the corresponding type, attach the TypedBuiltin to the value part of the TermOf and pass that to a continuation.