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

PlutusCore.Generators.QuickCheck.GenTm

Synopsis

Documentation

type GenTm = GenT (Reader GenEnv) Source #

Term generators carry around a context to know e.g. what types and terms are in scope.

data GenEnv Source #

Constructors

GenEnv 

Fields

suchThatMapMonad m ⇒ GenT m a → (a → Maybe b) → GenT m b Source #

Create a generator that runs the given generator and applies the given function to produced values until the result is a Just y, returning the y.

withDebugGenTm a → GenTm a Source #

Run a generator in debug-mode.

runGenTmGenTm a → Gen a Source #

Run a `GenTm generator in a top-level empty context where we are allowed to generate datatypes.

runGenTmCustomInt → (Maybe (Type TyName DefaultUni ()) → GenTm (Type TyName DefaultUni (), Term TyName Name DefaultUni DefaultFun ())) → GenTm a → Gen a Source #

Run a GenTm generator with a plug-in custom generator for terms that is included with the other generators.

deliverMonad m ⇒ GenT m (Maybe a) → GenT m a Source #

Create a generator that runs the given generator until the result is a Just x, returning the x.

withNoEscapeGenTm a → GenTm a Source #

Don't allow types to escape from a generator.

onAstSize ∷ (IntInt) → GenTm a → GenTm a Source #

Map a function over the generator size

ifAstSizeZeroGenTm a → GenTm a → GenTm a Source #

Default to the first generator if the size is zero (or negative), use the second generator otherwise.

withAstSizeIntGenTm a → GenTm a Source #

Locally set the size in a generator

astSizeSplit_IntIntGenTm a → GenTm b → GenTm (a, b) Source #

Split the size between two generators in the ratio specified by the first two arguments.

astSizeSplitIntIntGenTm a → (a → GenTm b) → GenTm (a, b) Source #

Split the size between two generators in the ratio specified by the first two arguments and use the result of the first generator in the second.

getUniquesGenTm (Set Unique) Source #

Get all uniques we have generated and are used in the current context.

genLikelyFreshNameStringGenTm Name Source #

Generate a likely fresh name. See Note [Warning about generating fresh names].

genLikelyFreshNames ∷ [String] → GenTm [Name] Source #

Generate one likely fresh name per string in the input list. Note that this may not give you a fresh name, if it happens to generate a name that was removed from the terms map in bindTyName (due to referencing a now-shadowed type variable) but is still in the scope.

genLikelyNotFreshNameStringGenTm Name Source #

Generate a name that likely overlaps with existing names on purpose. If there are no existing names, generate a fresh name. This function doesn't distinguish between the type- and term-level scopes, hence it may generate a Name "clashing" with a previously generated TyName and not clashing with any previously generated Name. Which is a good thing, because we want to check that Plutus is able to handle such spurious name clashes. Generating weird stuff is useful for a testing machinery! We don't need any "definitely non-fresh name" anyway, since we get enough non-fresh names already.

genMaybeFreshNameStringGenTm Name Source #

Generate a fresh name most (roughly 75%) of the time and otherwise generate an already bound name. When there are no bound names generate a fresh name.

bindTyNameTyNameKind () → GenTm a → GenTm a Source #

Bind a type name to a kind and avoid capturing free type variables.

bindTyNames ∷ [(TyName, Kind ())] → GenTm a → GenTm a Source #

Bind type names

registerTyNameTyNameGenTm a → GenTm a Source #

Remember that we have generated a type name locally but don't bind it. Useful for non-recursive definitions where we want to control name overlap.

bindTmNameNameType TyName DefaultUni () → GenTm a → GenTm a Source #

Bind a term to a type in a generator.

bindTmNames ∷ [(Name, Type TyName DefaultUni ())] → GenTm a → GenTm a Source #

Bind term names

bindLikelyFreshTmNameStringType TyName DefaultUni () → (NameGenTm a) → GenTm a Source #

Create a fresh term name, bind it to a type, and use it in a generator.

bindDatDatatype TyName Name DefaultUni () → GenTm a → GenTm a Source #

Bind a datatype declaration in a generator.

bindBindBinding TyName Name DefaultUni DefaultFun () → GenTm a → GenTm a Source #

Bind a binding.

bindBindsFoldable f ⇒ f (Binding TyName Name DefaultUni DefaultFun ()) → GenTm a → GenTm a Source #

Bind multiple bindings

class (Applicative g, Monad g) ⇒ MonadGen (g ∷ TypeType) where Source #

Methods

liftGenGen a → g a Source #

variantIntegral n ⇒ n → g a → g a Source #

sized ∷ (Int → g a) → g a Source #

resizeInt → g a → g a Source #

chooseRandom a ⇒ (a, a) → g a Source #

Instances

Instances details
MonadGen Gen 
Instance details

Defined in Test.QuickCheck.GenT

Methods

liftGenGen a → Gen a Source #

variantIntegral n ⇒ n → Gen a → Gen a Source #

sized ∷ (IntGen a) → Gen a Source #

resizeIntGen a → Gen a Source #

chooseRandom a ⇒ (a, a) → Gen a Source #

(Applicative m, Monad m) ⇒ MonadGen (GenT m) 
Instance details

Defined in Test.QuickCheck.GenT

Methods

liftGenGen a → GenT m a Source #

variantIntegral n ⇒ n → GenT m a → GenT m a Source #

sized ∷ (IntGenT m a) → GenT m a Source #

resizeIntGenT m a → GenT m a Source #

chooseRandom a ⇒ (a, a) → GenT m a Source #

newtype GenT (m ∷ TypeType) a Source #

Constructors

GenT 

Fields

Instances

Instances details
MonadTrans GenT 
Instance details

Defined in Test.QuickCheck.GenT.Private

Methods

liftMonad m ⇒ m a → GenT m a Source #

MonadReader r m ⇒ MonadReader r (GenT m) Source # 
Instance details

Defined in PlutusCore.Generators.QuickCheck.GenTm

Methods

askGenT m r Source #

local ∷ (r → r) → GenT m a → GenT m a Source #

reader ∷ (r → a) → GenT m a Source #

MonadFail m ⇒ MonadFail (GenT m) 
Instance details

Defined in Test.QuickCheck.GenT.Private

Methods

failStringGenT m a Source #

MonadIO m ⇒ MonadIO (GenT m) 
Instance details

Defined in Test.QuickCheck.GenT.Private

Methods

liftIOIO a → GenT m a Source #

(Functor m, Monad m) ⇒ Applicative (GenT m) 
Instance details

Defined in Test.QuickCheck.GenT.Private

Methods

pure ∷ a → GenT m a Source #

(<*>)GenT m (a → b) → GenT m a → GenT m b Source #

liftA2 ∷ (a → b → c) → GenT m a → GenT m b → GenT m c Source #

(*>)GenT m a → GenT m b → GenT m b Source #

(<*)GenT m a → GenT m b → GenT m a Source #

Functor m ⇒ Functor (GenT m) 
Instance details

Defined in Test.QuickCheck.GenT.Private

Methods

fmap ∷ (a → b) → GenT m a → GenT m b Source #

(<$) ∷ a → GenT m b → GenT m a Source #

Monad m ⇒ Monad (GenT m) 
Instance details

Defined in Test.QuickCheck.GenT.Private

Methods

(>>=)GenT m a → (a → GenT m b) → GenT m b Source #

(>>)GenT m a → GenT m b → GenT m b Source #

return ∷ a → GenT m a Source #

(Applicative m, Monad m) ⇒ MonadGen (GenT m) 
Instance details

Defined in Test.QuickCheck.GenT

Methods

liftGenGen a → GenT m a Source #

variantIntegral n ⇒ n → GenT m a → GenT m a Source #

sized ∷ (IntGenT m a) → GenT m a Source #

resizeIntGenT m a → GenT m a Source #

chooseRandom a ⇒ (a, a) → GenT m a Source #

suchThatMonadGen m ⇒ m a → (a → Bool) → m a Source #

Generates a value that satisfies a predicate.

suchThatMaybeMonadGen m ⇒ m a → (a → Bool) → m (Maybe a) Source #

Tries to generate a value that satisfies a predicate.

oneofMonadGen m ⇒ [m a] → m a Source #

Randomly uses one of the given generators. The input list must be non-empty.

frequencyMonadGen m ⇒ [(Int, m a)] → m a Source #

Chooses one of the given generators, with a weighted random distribution. The input list must be non-empty.

elementsMonadGen m ⇒ [a] → m a Source #

Generates one of the given values. The input list must be non-empty.

growingElementsMonadGen m ⇒ [a] → m a Source #

Takes a list of elements of increasing size, and chooses among an initial segment of the list. The size of this initial segment increases with the size parameter. The input list must be non-empty.

listOfMonadGen m ⇒ m a → m [a] Source #

Generates a list of random length. The maximum length depends on the size parameter.

listOf1MonadGen m ⇒ m a → m [a] Source #

Generates a non-empty list of random length. The maximum length depends on the size parameter.

vectorOfMonadGen m ⇒ Int → m a → m [a] Source #

Generates a list of the given length.

runGenTGenT m a → Gen (m a) Source #

oneofMayMonadGen m ⇒ [m a] → m (Maybe a) Source #

Randomly uses one of the given generators.

elementsMayMonadGen m ⇒ [a] → m (Maybe a) Source #

Generates one of the given values.

growingElementsMayMonadGen m ⇒ [a] → m (Maybe a) Source #

Takes a list of elements of increasing size, and chooses among an initial segment of the list. The size of this initial segment increases with the size parameter.

class Arbitrary a where Source #

Random generation and shrinking of values.

QuickCheck provides Arbitrary instances for most types in base, except those which incur extra dependencies. For a wider range of Arbitrary instances see the quickcheck-instances package.

Minimal complete definition

arbitrary

Methods

arbitraryGen a Source #

A generator for values of the given type.

It is worth spending time thinking about what sort of test data you want - good generators are often the difference between finding bugs and not finding them. You can use sample, label and classify to check the quality of your test data.

There is no generic arbitrary implementation included because we don't know how to make a high-quality one. If you want one, consider using the testing-feat or generic-random packages.

The QuickCheck manual goes into detail on how to write good generators. Make sure to look at it, especially if your type is recursive!

shrink ∷ a → [a] Source #

Produces a (possibly) empty list of all the possible immediate shrinks of the given value.

The default implementation returns the empty list, so will not try to shrink the value. If your data type has no special invariants, you can enable shrinking by defining shrink = genericShrink, but by customising the behaviour of shrink you can often get simpler counterexamples.

Most implementations of shrink should try at least three things:

  1. Shrink a term to any of its immediate subterms. You can use subterms to do this.
  2. Recursively apply shrink to all immediate subterms. You can use recursivelyShrink to do this.
  3. Type-specific shrinkings such as replacing a constructor by a simpler constructor.

For example, suppose we have the following implementation of binary trees:

data Tree a = Nil | Branch a (Tree a) (Tree a)

We can then define shrink as follows:

shrink Nil = []
shrink (Branch x l r) =
  -- shrink Branch to Nil
  [Nil] ++
  -- shrink to subterms
  [l, r] ++
  -- recursively shrink subterms
  [Branch x' l' r' | (x', l', r') <- shrink (x, l, r)]

There are a couple of subtleties here:

  • QuickCheck tries the shrinking candidates in the order they appear in the list, so we put more aggressive shrinking steps (such as replacing the whole tree by Nil) before smaller ones (such as recursively shrinking the subtrees).
  • It is tempting to write the last line as [Branch x' l' r' | x' <- shrink x, l' <- shrink l, r' <- shrink r] but this is the wrong thing! It will force QuickCheck to shrink x, l and r in tandem, and shrinking will stop once one of the three is fully shrunk.

There is a fair bit of boilerplate in the code above. We can avoid it with the help of some generic functions. The function genericShrink tries shrinking a term to all of its subterms and, failing that, recursively shrinks the subterms. Using it, we can define shrink as:

shrink x = shrinkToNil x ++ genericShrink x
  where
    shrinkToNil Nil = []
    shrinkToNil (Branch _ l r) = [Nil]

genericShrink is a combination of subterms, which shrinks a term to any of its subterms, and recursivelyShrink, which shrinks all subterms of a term. These may be useful if you need a bit more control over shrinking than genericShrink gives you.

A final gotcha: we cannot define shrink as simply shrink x = Nil:genericShrink x as this shrinks Nil to Nil, and shrinking will go into an infinite loop.

If all this leaves you bewildered, you might try shrink = genericShrink to begin with, after deriving Generic for your type. However, if your data type has any special invariants, you will need to check that genericShrink can't break those invariants.

Instances

Instances details
Arbitrary ASCIIString 
Instance details

Defined in Test.QuickCheck.Modifiers

Arbitrary PrintableString 
Instance details

Defined in Test.QuickCheck.Modifiers

Arbitrary UnicodeString 
Instance details

Defined in Test.QuickCheck.Modifiers

Arbitrary QCGen 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen QCGen Source #

shrink ∷ QCGen → [QCGen] Source #

Arbitrary Key

Since: aeson-2.0.3.0

Instance details

Defined in Data.Aeson.Key

Methods

arbitraryGen Key Source #

shrinkKey → [Key] Source #

Arbitrary Value

Since: aeson-2.0.3.0

Instance details

Defined in Data.Aeson.Types.Internal

Arbitrary All 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen All Source #

shrinkAll → [All] Source #

Arbitrary Any 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen Any Source #

shrinkAny → [Any] Source #

Arbitrary Version

Generates Version with non-empty non-negative versionBranch, and empty versionTags

Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CChar 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CClock 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CDouble 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CFloat 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CInt 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CIntMax 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CIntPtr 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CLLong 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CLong 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CPtrdiff 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CSChar 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CSUSeconds 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CShort 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CSigAtomic 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CSize 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CTime 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CUChar 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CUInt 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CUIntMax 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CUIntPtr 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CULLong 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CULong 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CUSeconds 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CUShort 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CWchar 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary ExitCode 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Newline 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary NewlineMode 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Int16 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Int32 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Int64 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Int8 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Word16 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Word32 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Word64 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Word8 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary IntSet

WARNING: The same warning as for Arbitrary (Set a) applies here.

Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Ordering 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Data Source # 
Instance details

Defined in PlutusCore.Generators.QuickCheck.Builtin

Arbitrary Integer 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary () 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen () Source #

shrink ∷ () → [()] Source #

Arbitrary Bool 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Char 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Double 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Float 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Int 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen Int Source #

shrinkInt → [Int] Source #

Arbitrary Word 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary a ⇒ Arbitrary (Blind a) 
Instance details

Defined in Test.QuickCheck.Modifiers

Methods

arbitraryGen (Blind a) Source #

shrinkBlind a → [Blind a] Source #

Arbitrary a ⇒ Arbitrary (Fixed a) 
Instance details

Defined in Test.QuickCheck.Modifiers

Methods

arbitraryGen (Fixed a) Source #

shrinkFixed a → [Fixed a] Source #

Arbitrary a ⇒ Arbitrary (InfiniteList a) 
Instance details

Defined in Test.QuickCheck.Modifiers

Arbitrary a ⇒ Arbitrary (InfiniteListInternalData a) 
Instance details

Defined in Test.QuickCheck.Modifiers

Methods

arbitraryGen (InfiniteListInternalData a) Source #

shrink ∷ InfiniteListInternalData a → [InfiniteListInternalData a] Source #

(Integral a, Bounded a) ⇒ Arbitrary (Large a) 
Instance details

Defined in Test.QuickCheck.Modifiers

Methods

arbitraryGen (Large a) Source #

shrinkLarge a → [Large a] Source #

(Num a, Ord a, Arbitrary a) ⇒ Arbitrary (Negative a) 
Instance details

Defined in Test.QuickCheck.Modifiers

Arbitrary a ⇒ Arbitrary (NonEmptyList a) 
Instance details

Defined in Test.QuickCheck.Modifiers

(Num a, Ord a, Arbitrary a) ⇒ Arbitrary (NonNegative a) 
Instance details

Defined in Test.QuickCheck.Modifiers

(Num a, Ord a, Arbitrary a) ⇒ Arbitrary (NonPositive a) 
Instance details

Defined in Test.QuickCheck.Modifiers

(Num a, Eq a, Arbitrary a) ⇒ Arbitrary (NonZero a) 
Instance details

Defined in Test.QuickCheck.Modifiers

Methods

arbitraryGen (NonZero a) Source #

shrinkNonZero a → [NonZero a] Source #

(Ord a, Arbitrary a) ⇒ Arbitrary (OrderedList a) 
Instance details

Defined in Test.QuickCheck.Modifiers

(Num a, Ord a, Arbitrary a) ⇒ Arbitrary (Positive a) 
Instance details

Defined in Test.QuickCheck.Modifiers

Arbitrary a ⇒ Arbitrary (Shrink2 a) 
Instance details

Defined in Test.QuickCheck.Modifiers

Methods

arbitraryGen (Shrink2 a) Source #

shrinkShrink2 a → [Shrink2 a] Source #

Integral a ⇒ Arbitrary (Small a) 
Instance details

Defined in Test.QuickCheck.Modifiers

Methods

arbitraryGen (Small a) Source #

shrinkSmall a → [Small a] Source #

Arbitrary a ⇒ Arbitrary (Smart a) 
Instance details

Defined in Test.QuickCheck.Modifiers

Methods

arbitraryGen (Smart a) Source #

shrinkSmart a → [Smart a] Source #

(Arbitrary a, Ord a) ⇒ Arbitrary (SortedList a) 
Instance details

Defined in Test.QuickCheck.Modifiers

Arbitrary a ⇒ Arbitrary (Stream a) 
Instance details

Defined in Data.Stream

Methods

arbitraryGen (Stream a) Source #

shrinkStream a → [Stream a] Source #

Arbitrary v ⇒ Arbitrary (KeyMap v)

Since: aeson-2.0.3.0

Instance details

Defined in Data.Aeson.KeyMap

Methods

arbitraryGen (KeyMap v) Source #

shrinkKeyMap v → [KeyMap v] Source #

Arbitrary a ⇒ Arbitrary (ZipList a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (ZipList a) Source #

shrinkZipList a → [ZipList a] Source #

Arbitrary a ⇒ Arbitrary (Complex a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (Complex a) Source #

shrinkComplex a → [Complex a] Source #

Arbitrary a ⇒ Arbitrary (Identity a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary a ⇒ Arbitrary (First a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (First a) Source #

shrinkFirst a → [First a] Source #

Arbitrary a ⇒ Arbitrary (Last a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (Last a) Source #

shrinkLast a → [Last a] Source #

Arbitrary a ⇒ Arbitrary (Dual a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (Dual a) Source #

shrinkDual a → [Dual a] Source #

(Arbitrary a, CoArbitrary a) ⇒ Arbitrary (Endo a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (Endo a) Source #

shrinkEndo a → [Endo a] Source #

Arbitrary a ⇒ Arbitrary (Product a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (Product a) Source #

shrinkProduct a → [Product a] Source #

Arbitrary a ⇒ Arbitrary (Sum a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (Sum a) Source #

shrinkSum a → [Sum a] Source #

Integral a ⇒ Arbitrary (Ratio a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (Ratio a) Source #

shrinkRatio a → [Ratio a] Source #

Arbitrary a ⇒ Arbitrary (IntMap a)

WARNING: The same warning as for Arbitrary (Set a) applies here.

Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (IntMap a) Source #

shrinkIntMap a → [IntMap a] Source #

Arbitrary a ⇒ Arbitrary (Seq a)

WARNING: The same warning as for Arbitrary (Set a) applies here.

Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (Seq a) Source #

shrinkSeq a → [Seq a] Source #

(Ord a, Arbitrary a) ⇒ Arbitrary (Set a)

WARNING: Users working on the internals of the Set type via e.g. Data.Set.Internal should be aware that this instance aims to give a good representation of Set a as mathematical sets but *does not* aim to provide a varied distribution over the underlying representation.

Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (Set a) Source #

shrinkSet a → [Set a] Source #

Arbitrary a ⇒ Arbitrary (Tree a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (Tree a) Source #

shrinkTree a → [Tree a] Source #

Arbitrary (BuiltinSemanticsVariant DefaultFun) Source # 
Instance details

Defined in PlutusIR.Pass.Test

Arbitrary (Kind ()) Source # 
Instance details

Defined in PlutusCore.Generators.QuickCheck.GenerateKinds

Methods

arbitraryGen (Kind ()) Source #

shrinkKind () → [Kind ()] Source #

Arbitrary (SomeTypeIn DefaultUni) Source # 
Instance details

Defined in PlutusCore.Generators.QuickCheck.Builtin

ArbitraryBuiltin a ⇒ Arbitrary (AsArbitraryBuiltin a) Source # 
Instance details

Defined in PlutusCore.Generators.QuickCheck.Builtin

KnownKind k ⇒ Arbitrary (MaybeSomeTypeOf k) Source # 
Instance details

Defined in PlutusCore.Generators.QuickCheck.Builtin

Arbitrary a ⇒ Arbitrary (Maybe a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (Maybe a) Source #

shrinkMaybe a → [Maybe a] Source #

Arbitrary a ⇒ Arbitrary [a] 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen [a] Source #

shrink ∷ [a] → [[a]] Source #

(Function a, CoArbitrary a, Arbitrary b) ⇒ Arbitrary (a :-> b) 
Instance details

Defined in Test.QuickCheck.Function

Methods

arbitraryGen (a :-> b) Source #

shrink ∷ (a :-> b) → [a :-> b] Source #

(Function a, CoArbitrary a, Arbitrary b) ⇒ Arbitrary (Fun a b) 
Instance details

Defined in Test.QuickCheck.Function

Methods

arbitraryGen (Fun a b) Source #

shrinkFun a b → [Fun a b] Source #

(Arbitrary a, ShrinkState s a) ⇒ Arbitrary (Shrinking s a) 
Instance details

Defined in Test.QuickCheck.Modifiers

Methods

arbitraryGen (Shrinking s a) Source #

shrinkShrinking s a → [Shrinking s a] Source #

Arbitrary (m a) ⇒ Arbitrary (WrappedMonad m a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

(Arbitrary a, Arbitrary b) ⇒ Arbitrary (Either a b) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (Either a b) Source #

shrinkEither a b → [Either a b] Source #

HasResolution a ⇒ Arbitrary (Fixed a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (Fixed a) Source #

shrinkFixed a → [Fixed a] Source #

(Ord k, Arbitrary k, Arbitrary v) ⇒ Arbitrary (Map k v)

WARNING: The same warning as for Arbitrary (Set a) applies here.

Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (Map k v) Source #

shrinkMap k v → [Map k v] Source #

Arbitrary (Some (ValueOf DefaultUni)) Source # 
Instance details

Defined in PlutusCore.Generators.QuickCheck.Builtin

(Arbitrary a, Arbitrary b) ⇒ Arbitrary (a, b) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (a, b) Source #

shrink ∷ (a, b) → [(a, b)] Source #

(CoArbitrary a, Arbitrary b) ⇒ Arbitrary (a → b) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (a → b) Source #

shrink ∷ (a → b) → [a → b] Source #

Arbitrary (a b c) ⇒ Arbitrary (WrappedArrow a b c) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (WrappedArrow a b c) Source #

shrinkWrappedArrow a b c → [WrappedArrow a b c] Source #

Arbitrary a ⇒ Arbitrary (Const a b) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (Const a b) Source #

shrinkConst a b → [Const a b] Source #

Arbitrary (f a) ⇒ Arbitrary (Alt f a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (Alt f a) Source #

shrinkAlt f a → [Alt f a] Source #

Arbitrary a ⇒ Arbitrary (Constant a b) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (Constant a b) Source #

shrinkConstant a b → [Constant a b] Source #

(Arbitrary a, Arbitrary b, Arbitrary c) ⇒ Arbitrary (a, b, c) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (a, b, c) Source #

shrink ∷ (a, b, c) → [(a, b, c)] Source #

(Arbitrary1 f, Arbitrary1 g, Arbitrary a) ⇒ Arbitrary (Product f g a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (Product f g a) Source #

shrinkProduct f g a → [Product f g a] Source #

(Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d) ⇒ Arbitrary (a, b, c, d) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (a, b, c, d) Source #

shrink ∷ (a, b, c, d) → [(a, b, c, d)] Source #

(Arbitrary1 f, Arbitrary1 g, Arbitrary a) ⇒ Arbitrary (Compose f g a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (Compose f g a) Source #

shrinkCompose f g a → [Compose f g a] Source #

(Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d, Arbitrary e) ⇒ Arbitrary (a, b, c, d, e) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (a, b, c, d, e) Source #

shrink ∷ (a, b, c, d, e) → [(a, b, c, d, e)] Source #

(Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d, Arbitrary e, Arbitrary f) ⇒ Arbitrary (a, b, c, d, e, f) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (a, b, c, d, e, f) Source #

shrink ∷ (a, b, c, d, e, f) → [(a, b, c, d, e, f)] Source #

(Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d, Arbitrary e, Arbitrary f, Arbitrary g) ⇒ Arbitrary (a, b, c, d, e, f, g) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (a, b, c, d, e, f, g) Source #

shrink ∷ (a, b, c, d, e, f, g) → [(a, b, c, d, e, f, g)] Source #

(Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d, Arbitrary e, Arbitrary f, Arbitrary g, Arbitrary h) ⇒ Arbitrary (a, b, c, d, e, f, g, h) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (a, b, c, d, e, f, g, h) Source #

shrink ∷ (a, b, c, d, e, f, g, h) → [(a, b, c, d, e, f, g, h)] Source #

(Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d, Arbitrary e, Arbitrary f, Arbitrary g, Arbitrary h, Arbitrary i) ⇒ Arbitrary (a, b, c, d, e, f, g, h, i) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (a, b, c, d, e, f, g, h, i) Source #

shrink ∷ (a, b, c, d, e, f, g, h, i) → [(a, b, c, d, e, f, g, h, i)] Source #

(Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d, Arbitrary e, Arbitrary f, Arbitrary g, Arbitrary h, Arbitrary i, Arbitrary j) ⇒ Arbitrary (a, b, c, d, e, f, g, h, i, j) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitraryGen (a, b, c, d, e, f, g, h, i, j) Source #

shrink ∷ (a, b, c, d, e, f, g, h, i, j) → [(a, b, c, d, e, f, g, h, i, j)] Source #

data Gen a Source #

A generator for values of type a.

The third-party packages QuickCheck-GenT and quickcheck-transformer provide monad transformer versions of Gen.

Instances

Instances details
MonadFix Gen 
Instance details

Defined in Test.QuickCheck.Gen

Methods

mfix ∷ (a → Gen a) → Gen a Source #

Applicative Gen 
Instance details

Defined in Test.QuickCheck.Gen

Methods

pure ∷ a → Gen a Source #

(<*>)Gen (a → b) → Gen a → Gen b Source #

liftA2 ∷ (a → b → c) → Gen a → Gen b → Gen c Source #

(*>)Gen a → Gen b → Gen b Source #

(<*)Gen a → Gen b → Gen a Source #

Functor Gen 
Instance details

Defined in Test.QuickCheck.Gen

Methods

fmap ∷ (a → b) → Gen a → Gen b Source #

(<$) ∷ a → Gen b → Gen a Source #

Monad Gen 
Instance details

Defined in Test.QuickCheck.Gen

Methods

(>>=)Gen a → (a → Gen b) → Gen b Source #

(>>)Gen a → Gen b → Gen b Source #

return ∷ a → Gen a Source #

MonadGen Gen 
Instance details

Defined in Test.QuickCheck.GenT

Methods

liftGenGen a → Gen a Source #

variantIntegral n ⇒ n → Gen a → Gen a Source #

sized ∷ (IntGen a) → Gen a Source #

resizeIntGen a → Gen a Source #

chooseRandom a ⇒ (a, a) → Gen a Source #

Testable prop ⇒ Testable (Gen prop) 
Instance details

Defined in Test.QuickCheck.Property

Methods

propertyGen prop → Property Source #

propertyForAllShrinkShowGen a → (a → [a]) → (a → [String]) → (a → Gen prop) → Property Source #

Orphan instances

MonadReader r m ⇒ MonadReader r (GenT m) Source # 
Instance details

Methods

askGenT m r Source #

local ∷ (r → r) → GenT m a → GenT m a Source #

reader ∷ (r → a) → GenT m a Source #