package osnap

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
include module type of Spec
module Gen : sig ... end
type 'a gen = 'a QCheck.Gen.t

'a gen is used to generate random values inside spec. QCheck combinators are available using Spec.Gen.

type 'a printer = 'a -> string

'a printer is used to store randomly generated values

type 'a spec = {
  1. gen : 'a gen;
  2. printer : 'a printer;
}

'a spec combines an 'a gen and a printer

type ('fn, 'r) t =
  1. | Result : 'a printer -> ('a, 'a) t
  2. | Arrow : 'a spec * ('fn, 'r) t -> ('a -> 'fn, 'r) t

t is the specification type, describing a function. Thus t declaration must end with (^>>).

val unit : unit spec

unit specification

val bool : bool spec

bool specification

val float : float spec

float specification

val int : int spec

int specification

val char : char spec

char specification

val string : string spec

string specification

val option : 'a spec -> 'a option spec

option spec creates an option spec for spec

val array : 'a spec -> 'a array spec

array spec creates an array spec for spec

val list : 'a spec -> 'a list spec

list spec creates a list spec for spec

val (^>) : 'a spec -> ('b, 'c) t -> ('a -> 'b, 'c) t

(^>) x y combines spec x and y to create x -> y

val (^>>) : 'a spec -> 'b printer -> ('a -> 'b, 'b) t

(^>>) x res combines a specification and printer for the result type

OCaml

Innovation. Community. Security.