Motivation
Motivationā
The background and motivation for Hedgehog in general is still best described by the original author in this excellent presenation:
- Watch it on Youtube: Gens Nā Roses: Appetite for Reduction (slides)
A very quick summary is that the original QuickCheck and its derivatives (like ScalaCheck) separate the generation of data from the shrinking, which results in something that cannot be composed easily. It turns out it's fairly simple to combine them in a single data-type.
If you've used ScalaCheck before, it's exactly the same as writing your normal Gen
functions,
but now those generated value will shrink without any extra information. Magic!
Design Considerationsā
As a general rule, the current Scala API is intended to be direct port of haskell-hedgehog, much like scalacheck was for QuickCheck. The idea being that people familiar with one of the libraries will be comfortable with the other. It also makes it easier not having to re-invent any wheels (or APIs). There will obviously be exceptions where Scala forces us to make a different trade-off. See haskell-differences for examples and more explanation.