Seelengrab / Supposition.jl

A Julia implementation of choice sequence based PBT, inspired by Hypothesis
https://seelengrab.github.io/Supposition.jl/
European Union Public License 1.2
46 stars 2 forks source link

`Data.recursive` is mentioned but not documented #11

Closed jariji closed 8 months ago

jariji commented 8 months ago

It should be either documented or not mentioned.

help?> Data.Recursive
  Recursive(base::Possibility, extend; max_layers::Int=5) <: Possibility{T}

  A Possibility for generating recursive data structures. base is the basecase of the recursion. extend is a function
  returning a new Possibility when given a Possibility, called to recursively expand a tree starting from base.

  max_layers designates the maximum number of times extend will be used to wrap base in new layers. This must be at least 1,
  so that at least the base case can always be generated.

  Examples
  ========

  julia> base = Data.Integers{UInt8}()

  julia> wrap(pos) = Data.Vectors(pos; min_size=2, max_size=3)

  julia> rec = Data.recursive(wrap, base; max_layers=3);
help?> Data.recursive
  No documentation found.

  Supposition.Data.recursive is a Function.
Seelengrab commented 8 months ago

Yes, this should get a docstring. The purpose of recursive is to enable do-notation for wrapping, like so:

julia> using Supposition

julia> gen = Data.recursive(Data.Integers{UInt8}()) do u
           Data.Vectors(u; min_size=1, max_size=2)
       end;

julia> example(gen)
1-element Vector{Union{UInt8, Vector{UInt8}, Vector{Union{UInt8, Vector{UInt8}}}}}:
 Union{UInt8, Vector{UInt8}}[UInt8[0xdc]]