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

PlutusCore.Generators.QuickCheck.ShrinkTypes

Description

This module defines the type shrinker. The shrinking order isn't specified, so the shrinker may or may not behave correctly, we don't really know. If shrinking ever loops, feel free to kill this module or reverse-engineer the shrinker and fix the problem.

Synopsis

Documentation

minimalTypeKind () → Type TyName DefaultUni () Source #

Give a unique "least" (intentionally vaguely specified by "shrinking order") type of that kind. Note: this function requires care and attention to not get a shrinking loop. If you think you need to mess with this function: 0. First, you *must* read the note Note [Avoiding Shrinking Loops] 1. You're probably wrong, think again and 2. If you're sure you're not wrong you need to be very careful and test the shrinking to make sure you don't get in a loop. 3. Finally, you *must* read the note Note [Avoiding Shrinking Loops]

fixKindHasCallStackTypeCtxType TyName DefaultUni () → Kind () → Type TyName DefaultUni () Source #

Take a type in a context and a target kind and try adjust the type to have the target kind. If can't make the adjusting successful, return the minimalType of the target kind. Precondition: new kind is smaller or equal to old kind of the type. Complies with the implicit shrinking order. TODO (later): also allow changing which context it's valid in

shrinkKindAndTypeHasCallStackTypeCtx → (Kind (), Type TyName DefaultUni ()) → [(Kind (), Type TyName DefaultUni ())] Source #

Shrink a well-kinded type in a context to new types, possibly with new kinds. The new kinds are guaranteed to be smaller than or equal to the old kind. TODO: also shrink to new context need old context and new context

shrinkTypeHasCallStackTypeCtxType TyName DefaultUni () → [Type TyName DefaultUni ()] Source #

Shrink a type in a context assuming that it is of kind *.

shrinkTypeAtKindHasCallStackTypeCtxKind () → Type TyName DefaultUni () → [Type TyName DefaultUni ()] Source #

Shrink a type of a given kind in a given context in a way that keeps its kind