Gen Monad #
This monad is used to formulate randomized computations with a parameter to specify the desired size of the result.
Main definitions #
Genmonad
References #
Error thrown on generation failure, e.g. because you've run out of resources.
Instances For
Order-theoretic instances on Except GenError #
These exist so that Gen (and definitions in it) can be the target of
partial_fixpoint. We give Except GenError α the flat order with
Except.error default as the bottom element, representing a
non-terminating / undefined computation. Any other .error e is then
incomparable with .ok _, which is why the bind_mono_* proofs only
need the bot and refl cases.
Get access to the size parameter of the Gen monad.
Instances For
The following section defines various combinators for generators, which are used
in the body of derived generators (for derived Arbitrary instances).
The code for these combinators closely mirrors those used in Rocq/Coq QuickChick (see link in the References section below).
References #
Raised when a fueled generator fails due to insufficient fuel.
Instances For
Tries all generators until one returns a Some value or all the generators failed once with None.
The generators are picked at random according to their weights (like frequency in Haskell QuickCheck),
and each generator is run at most once.
Instances For
Picks one of the generators in gs at random, returning the default generator
if gs is empty.
(This is a more ergonomic version of Plausible's Gen.oneOf which doesn't
require the caller to supply a proof that the list index is in bounds.)