qcheck/tree

This module provides a tree data structure used to represent a pseudo-randomly generated value an its shrunk values. This “integrated shrinking” is convenient as most generators get shrinking “for free” that that shrinking does not break invaraints.

Types

pub type Tree(a) {
  Tree(a, Iterator(Tree(a)))
}

Constructors

  • Tree(a, Iterator(Tree(a)))

Functions

pub fn apply(f: Tree(fn(a) -> b), x: Tree(a)) -> Tree(b)
pub fn bind(tree: Tree(a), f: fn(a) -> Tree(b)) -> Tree(b)
pub fn iterator_list(l: List(Tree(a))) -> Tree(List(a))
pub fn make_primitive(
  root x: a,
  shrink shrink: fn(a) -> Iterator(a),
) -> Tree(a)
pub fn map(tree: Tree(a), f: fn(a) -> b) -> Tree(b)
pub fn map2(f: fn(a, b) -> c, a: Tree(a), b: Tree(b)) -> Tree(c)
pub fn option(tree: Tree(a)) -> Tree(Option(a))
pub fn return(x: a) -> Tree(a)
pub fn to_string(
  tree: Tree(a),
  a_to_string: fn(a) -> String,
) -> String
pub fn to_string_(
  tree: Tree(a),
  a_to_string: fn(a) -> String,
  max_depth max_depth: Int,
) -> String
Search Document