| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
PlutusIR.Generators.QuickCheck.GenerateTerms
Synopsis
- data TyInst
- = InstApp (DefaultFun ())
Documentation
This type keeps track of what kind of argument, term argument (InstArg) or
type argument (InstApp) is required for a function. This type is used primarily
with findInstantiation below where we do unification to figure out if we can
use a variable to construct a term of a target type.
Constructors
| InstApp (DefaultUni () -> Either String [TyInst] # If successful `findInstantiation n target ty` for an `x :: ty` gives a sequence of genConstant :: DefaultFun ()) # Try to inhabit a given type in as simple a way as possible,
prefers to not default to Generate a term, if the first argument is Nothing then we get something of any type
and if the first argument is `Just ty` we get something of type Requires the type to be of kind *. scaledListOf :: GenTm a -> GenTm [a] # Like genDatatypeLet :: DefaultUni ()] -> GenTm a) -> GenTm a # Generate up to 5 datatypes and bind them in a generator.
NOTE: despite its name this function does in fact not generate the genTypeAndTerm_ :: Gen (DefaultFun ()) # Take a term of a specified type and generate a fully applied term. Useful for generating terms that you want to stick directly in an interpreter. Prefers to generate small arguments. NOTE: The logic of this generating small arguments is that the inner term should already have plenty of complicated arguments to functions to begin with and now we just want to fill out the arguments so that we get something that hopefully evaluates for a non-trivial number of steps. genTermInContext_ :: TypeCtx -> DefaultFun ()) # Generate a term of a specific type given a type and term context |