Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate properties into properties and specifications #22

Open
jackfirth opened this issue Nov 6, 2015 · 0 comments
Open

Separate properties into properties and specifications #22

jackfirth opened this issue Nov 6, 2015 · 0 comments

Comments

@jackfirth
Copy link
Collaborator

In the Haskell library, properties are merely functions (usually). Their types indicate how they're wired up to arbitraries, and that wiring happens "magically" through typeclasses. Racket however has neither typeclasses nor the ability to easily examine type-level information (I think that's possible through macros but it gets complicated fast). And many Racketeers use no types at all (gasp!).

In light of this, I propose separating properties (judgements about values) from specifications (claims that a property holds for certain sets of values). The Quickcheck user first creates a property. Any predicate can be a property, for example "even?". Then the user creates a specification claiming that the property holds for a set of inputs:

(define all-integers-even-spec
  (specification (property even?) arbitrary-integer))

By separating the two, properties can have richer semantics. For instance properties can return additional information like classifications and measurements of their inputs, and this can be expressed as a plain function rather than using the monadic approach of Haskell's QuickCheck. This also allows specifications to include more information, for instance a set of inputs to try every time (known bugs or corner cases) before trying arbitrary inputs (something that the Python version of quickcheck, Hypothesis, does).

@ifigueroap, @dented42, I've got some exploratory work in this direction and it seems promising. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant