Idris2Doc : Hedgehog.Internal.Gen

Hedgehog.Internal.Gen

(source)

Definitions

recordGen : Type->Type
  Generates random values of type `a`

Totality: total
Visibility: public export
Constructor: 
MkGen : (Size->StdGen->Cotreea) ->Gena

Projection: 
.unGen : Gena->Size->StdGen->Cotreea

Hints:
ApplicativeGen
FunctorGen
MonadGen
.unGen : Gena->Size->StdGen->Cotreea
Totality: total
Visibility: public export
unGen : Gena->Size->StdGen->Cotreea
Totality: total
Visibility: public export
runGen : Size->StdGen->Gena->Cotreea
Totality: total
Visibility: public export
mapGen : (Cotreea->Cotreeb) ->Gena->Genb
Totality: total
Visibility: public export
fromTree : Cotreea->Gena
  Lift a predefined shrink tree in to a generator, ignoring the seed and the
size.

Totality: total
Visibility: public export
toTree : Gena->Gen (Cotreea)
  Observe a generator's shrink tree.

Totality: total
Visibility: public export
generate : (Size->StdGen->a) ->Gena
Totality: total
Visibility: public export
shrink : (a->Colista) ->Gena->Gena
Totality: total
Visibility: public export
prune : Gena->Gena
Totality: total
Visibility: public export
sized : (Size->Gena) ->Gena
  Construct a generator that depends on the size parameter.

Totality: total
Visibility: public export
scale : (Size->Size) ->Gena->Gena
  Adjust the size parameter by transforming it with the given function.

Totality: total
Visibility: public export
resize : Size->Gena->Gena
  Override the size parameter. Returns a generator which uses the given size
instead of the runtime-size parameter.

Totality: total
Visibility: public export
golden : Size->Size
  Scale a size using the golden ratio.

> golden x = x / φ
> golden x = x / 1.61803..

Totality: total
Visibility: public export
small : Gena->Gena
  Make a generator smaller by scaling its size parameter.

Totality: total
Visibility: public export
integral_ : ToIntegera=>Rangea->Gena
  Generates a random integral number in the [inclusive,inclusive] range.

This generator does not shrink.

Totality: total
Visibility: public export
integral : ToIntegera=>Rangea->Gena
  Generates a random integral number in the given @[inclusive,inclusive]@ range.

When the generator tries to shrink, it will shrink towards the
'Range.origin' of the specified 'Range'.

For example, the following generator will produce a number between @1970@
and @2100@, but will shrink towards @2000@:

```
integral (Range.'Range.constantFrom' 2000 1970 2100) :: 'Gen' 'Int'
```

Some sample outputs from this generator might look like:

> === Outcome ===
> 1973
> === Shrinks ===
> 2000
> 1987
> 1980
> 1976
> 1974

> === Outcome ===
> 2061
> === Shrinks ===
> 2000
> 2031
> 2046
> 2054
> 2058
> 2060

Totality: total
Visibility: public export
int : RangeInt->GenInt
  Generates a random machine integer in the given range.

This is a specialization of `integral`, offered for convenience.

Totality: total
Visibility: public export
int8 : RangeInt8->GenInt8
  Generates a random 8-bit integer in the given range.

This is a specialization of `integral`, offered for convenience.

Totality: total
Visibility: public export
anyInt8 : GenInt8
  Generates a random 8-bit integer in the full available range.

This shrinks exponentially towards 0.

Totality: total
Visibility: public export
int16 : RangeInt16->GenInt16
  Generates a random 16-bit integer in the given range.

This is a specialization of `integral`, offered for convenience.

Totality: total
Visibility: public export
anyInt16 : GenInt16
  Generates a random 16-bit integer in the full available range.

This shrinks exponentially towards 0.

Totality: total
Visibility: public export
int32 : RangeInt32->GenInt32
  Generates a random 32-bit integer in the given range.

This is a specialization of `integral`, offered for convenience.

Totality: total
Visibility: public export
anyInt32 : GenInt32
  Generates a random 32-bit integer in the full available range.

This shrinks exponentially towards 0.

Totality: total
Visibility: public export
int64 : RangeInt64->GenInt64
  Generates a random 64-bit integer in the given range.

This is a specialization of `integral`, offered for convenience.

Totality: total
Visibility: public export
anyInt64 : GenInt64
  Generates a random 64-bit integer in the full available range.

This shrinks exponentially towards 0.

Totality: total
Visibility: public export
bits8 : RangeBits8->GenBits8
  Generates a random 8-bit integer in the given range.

This is a specialization of 'integral', offered for convenience.

Totality: total
Visibility: public export
anyBits8 : GenBits8
  Generates a random 8-bit signed integer in the full available range.

This shrinks exponentially towards 0.

Totality: total
Visibility: public export
bits16 : RangeBits16->GenBits16
  Generates a random 16-bit integer in the given range.

This is a specialization of 'integral', offered for convenience.

Totality: total
Visibility: public export
anyBits16 : GenBits16
  Generates a random 16-bit signed integer in the full available range.

This shrinks exponentially towards 0.

Totality: total
Visibility: public export
bits32 : RangeBits32->GenBits32
  Generates a random 32-bit integer in the given range.

This is a specialization of 'integral', offered for convenience.

Totality: total
Visibility: public export
anyBits32 : GenBits32
  Generates a random 32-bit signed integer in the full available range.

This shrinks exponentially towards 0.

Totality: total
Visibility: public export
bits64 : RangeBits64->GenBits64
  Generates a random 64-bit integer in the given range.

This is a specialization of 'integral', offered for convenience.

Totality: total
Visibility: public export
anyBits64 : GenBits64
  Generates a random 64-bit signed integer in the full available range.

This shrinks exponentially towards 0.

Totality: total
Visibility: public export
integer : RangeInteger->GenInteger
  Generates a random Integer in the given range.

This is a specialization of 'integral', offered for convenience.

Totality: total
Visibility: public export
nat : RangeNat->GenNat
  Generates a random Nat in the given range.

This is a specialization of 'integral', offered for convenience.

Totality: total
Visibility: public export
size : RangeSize->GenSize
  Generates a random Size in the given range.

This is a specialization of 'integral', offered for convenience.

Totality: total
Visibility: public export
fin : Range (Finn) ->Gen (Finn)
  Generates a random (Fin n) in the given range.

Totality: total
Visibility: public export
double_ : RangeDouble->GenDouble
  Generates a random fractional number in the [inclusive,exclusive) range.

This generator does not shrink.

Totality: total
Visibility: export
double : RangeDouble->GenDouble
  Generates a random floating-point number in the given range.

This generator works the same as 'integral', but for floating point numbers.

Totality: total
Visibility: export
constant : a->Gena
  Trivial generator that always produces the same element.

This is another name for `pure`.

Totality: total
Visibility: public export
element : Vect (Sk) a->Gena
  Randomly selects one of the elements in the vector.

This generator shrinks towards the first element in the vector.

Totality: total
Visibility: public export
element_ : Vect (Sk) a->Gena
  Randomly selects one of the elements in the vector.

This generator does not shrink.

Totality: total
Visibility: public export
choice : Vect (Sk) (Gena) ->Gena
  Randomly selects one of the generators in the vector.

This generator shrinks towards the first generator in the vector.

Totality: total
Visibility: public export
choice_ : Vect (Sk) (Gena) ->Gena
  Randomly selects one of the generators in the vector.

This generator does not shrink towards a particular
generator in the vector

Totality: total
Visibility: public export
frequency : Vect (Sk) (Nat, Gena) ->Gena
  Uses a weighted distribution to randomly select one of the generators in
the vector.

This generator shrinks towards the first generator in the vector.

Note that if the given frequencies sum up to 0, the first element
of the vector

Totality: total
Visibility: public export
bool : GenBool
  Generates a random boolean.

This generator shrinks to `False`.

Totality: total
Visibility: public export
unit : Gen ()
  Generates constant values of type `Unit"

Totality: total
Visibility: export
char : RangeChar->GenChar
  Generates a character in the given `Range`.

Shrinks towards the origin of the range.

Totality: total
Visibility: export
charc : Char->Char->GenChar
  Generates a character in the interval [lower,uppper].

Shrinks towards the lower value.

Totality: total
Visibility: export
binit : GenChar
  Generates an ASCII binit: `'0'..'1'`

Totality: total
Visibility: export
octit : GenChar
  Generates an ASCII octit: `'0'..'7'`

Totality: total
Visibility: export
digit : GenChar
  Generates an ASCII digit: `'0'..'9'`

Totality: total
Visibility: export
hexit : GenChar
  Generates an ASCII hexit: `'0'..'9', 'a'..'f', 'A'..'F'`

Totality: total
Visibility: export
lower : GenChar
  Generates an ASCII lowercase letter: `'a'..'z'`

Totality: total
Visibility: export
upper : GenChar
  Generates an ASCII uppercase letter: `'A'..'Z'`

Totality: total
Visibility: export
alpha : GenChar
  Generates an ASCII letter: `'a'..'z', 'A'..'Z'`

Totality: total
Visibility: export
alphaNum : GenChar
  Generates an ASCII letter or digit: `'a'..'z', 'A'..'Z', '0'..'9'`

Totality: total
Visibility: export
ascii : GenChar
  Generates an ASCII character: `'\0'..'\127'`

Totality: total
Visibility: export
printableAscii : GenChar
  Generates an printable ASCII character: `'\32'..'\126'`
Note: This includes the space character but no
line breaks or tabs

Totality: total
Visibility: export
latin : GenChar
  Generates a latin character: `'\0'..'\255'`

Totality: total
Visibility: export
printableLatin : GenChar
  Generates a printable latin character: `'\32'..'\126'` and `'\160'..'\255'`

Totality: total
Visibility: export
unicode : GenChar
  Generates a Unicode character, excluding noncharacters
and invalid standalone surrogates:
`'\0'..'\1114111'` (excluding '\55296'..'\57343', '\65534', '\65535')`

Totality: total
Visibility: export
printableUnicode : GenChar
  Generates a printable Unicode character, excluding noncharacters
and invalid standalone surrogates:
`'\0'..'\1114111'` (excluding '\0' .. '\31', '\127' .. '\159',
'\55296'..'\57343', and '\65534', '\65535')`

Totality: total
Visibility: export
unicodeAll : GenChar
  Generates a Unicode character, including noncharacters
but excluding invalid standalone surrogates: `0000..10FFFF`
(excluding D800..DFFFF)

Totality: total
Visibility: export
maybe : Gena->Gen (Maybea)
  Generates a 'Nothing' some of the time.

Totality: total
Visibility: export
either : Gena->Genb->Gen (Eitherab)
  Generates either an 'a' or a 'b'.

As the size grows, this generator generates @Right@s more often than @Left@s.

Totality: total
Visibility: export
either_ : Gena->Genb->Gen (Eitherab)
  Generates either an 'a' or a 'b', without bias.

This generator generates as many @Right@s as it does @Left@s.

Totality: total
Visibility: export
vect : (n : Nat) ->Gena->Gen (Vectna)
  Generates a list using a 'Range' to determine the length.

Totality: total
Visibility: export
list : RangeNat->Gena->Gen (Lista)
  Generates a list using a 'Range' to determine the length.

Totality: total
Visibility: export
list1 : RangeNat->Gena->Gen (List1a)
  Generates a non-empty list using a `Range` to determine the length.

Totality: total
Visibility: export
string : RangeNat->GenChar->GenString
  Generates a string using 'Range' to determine the length.

Totality: total
Visibility: export
hlist : AllGents->Gen (HListts)
  Generates an heterogeneous list being provided a generator for each element

Totality: total
Visibility: export
hvect : AllGents->Gen (HVectts)
  Generates an heterogeneous vect being provided a generator for each element

Totality: total
Visibility: export
np : NPGents->Gen (NPIts)
  Turns an n-ary product of generators into a generator
of n-ary products of the same type.

Totality: total
Visibility: export
ns : NPGents-> {auto0_ : NonEmptyts} ->Gen (NSIts)
  Turns an n-ary product of generators into a generator
of n-ary sums of the same type. This is a generalisation
of choice and shrinks towards the first sum type
in the list.

Totality: total
Visibility: export
ns_ : NPGents-> {auto0_ : NonEmptyts} ->Gen (NSIts)
  Turns an n-ary product of generators into a generator
of n-ary sums of the same type. This is a generalisation
of `choice_` and does not shrink towards a particular
sum type.

Totality: total
Visibility: export
sop : POPGentss-> {auto0_ : NonEmptytss} ->Gen (SOPItss)
Totality: total
Visibility: export
printWith : (HasIOio, Showa) =>Size->StdGen->Gena->io ()
  Print the value produced by a generator, and the first level of shrinks,
for the given size and seed.

Use 'print' to generate a value from a random seed.

Totality: total
Visibility: export
print : Showa=>HasIOio=>Gena->io ()
  Run a generator with a random seed and print the outcome, and the first
level of shrinks.

@
Gen.print (Gen.'enum' \'a\' \'f\')
@

> === Outcome ===
> 'd'
> === Shrinks ===
> 'a'
> 'b'
> 'c'

Totality: total
Visibility: export
sample : HasIOio=>Gena->ioa
  Generate a sample from a generator.

Totality: total
Visibility: export
renderTree : Showa=>Nat->Nat->Size->StdGen->Gena->String
  Render the shrink tree produced by a generator, for the given size and
seed up to the given depth and width.

Totality: total
Visibility: export
printTreeWith : Showa=>HasIOio=>Nat->Nat->Size->StdGen->Gena->io ()
  Print the shrink tree produced by a generator, for the given size and
seed.

Use 'printTree' to generate a value from a random seed.

Totality: total
Visibility: export
printTree : Showa=>HasIOio=>Nat->Nat->Gena->io ()
  Run a generator with a random seed and print the resulting shrink tree.

@
Gen.printTree (Gen.'enum' \'a\' \'f\')
@

> 'd'
> ├╼'a'
> ├╼'b'
> │ └╼'a'
> └╼'c'
> ├╼'a'
> └╼'b'
> └╼'a'

/This may not terminate when the tree is very large./

Totality: total
Visibility: export