Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- type PlcGenT uni fun m = GenT (ReaderT (BuiltinGensT uni fun m) m)
- data IterApp head arg = IterApp {
- _iterAppHead ∷ head
- _iterAppSpine ∷ [arg]
- data IterAppValue uni fun head arg r = IterAppValue {}
- runPlcT ∷ Monad m ⇒ TypedBuiltinGenT (Plain Term uni fun) m → PlcGenT uni fun m a → GenT m a
- withTypedBuiltinGen ∷ Monad m ⇒ Proxy fun → (∀ a. (KnownTypeAst TyName DefaultUni a, MakeKnown (Plain Term DefaultUni fun) a) ⇒ TypeRep a → GenT m c) → GenT m c
- 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)
- genTerm ∷ ∀ uni fun m. (uni ~ DefaultUni, Monad m) ⇒ TypedBuiltinGenT (Plain Term uni fun) m → DenotationContext (Plain Term uni fun) → Int → TypedBuiltinGenT (Plain Term uni fun) m
- genTermLoose ∷ Monad m ⇒ TypedBuiltinGenT (Plain Term DefaultUni DefaultFun) m
- 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
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").
IterApp | |
|
data IterAppValue uni fun head arg r Source #
One iterated application of a head
to arg
s represented in three distinct ways.
Instances
(PrettyBy config (Plain Term uni fun), PrettyBy config head, PrettyBy config arg, PrettyConst r) ⇒ PrettyBy config (IterAppValue uni fun head arg r) Source # | |
Defined in PlutusCore.Generators.Hedgehog.Entity prettyBy ∷ config → IterAppValue uni fun head arg r → Doc ann Source # prettyListBy ∷ config → [IterAppValue uni fun head arg r] → Doc ann Source # |
runPlcT ∷ Monad 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.
withTypedBuiltinGen ∷ Monad 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
∷ ∀ 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 |
→ Int | Depth of recursion. |
→ TypedBuiltinGenT (Plain Term uni fun) m |
genTermLoose ∷ Monad 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 #