Hedgehog is a property-based testing system, Haskell-Hedgehog is the very same testing system for Haskell. Use this tag for questions about the testing system, not for questions about the programming language Haskell.
Questions tagged [haskell-hedgehog]
21 questions
1
vote
0 answers
Hedgehog generator using IO
There is a post on the official Hedgehog site detailing how to write a Hedgehog generator that uses IO. The relevant code inside it is:
import Data.Text (Text)
import qualified Data.Text as T
import qualified Data.Text.IO as…

Jeremy
- 1,049
- 1
- 15
- 28
1
vote
1 answer
Haskell, define specialization of function that's polymorphic in type
When using state machines in hedgehog I have to define a function that updates my model state. Its type should be forall v. Ord1 v => state v -> input v -> Var output v -> state v (see Update constructor of Callback).
Now, I want to get to output,…

Magnus
- 4,644
- 1
- 33
- 49
1
vote
2 answers
Example that shows the limitations of integrated shrinking
I just watched a video that presents the notion of integrated shrinking for property based tests. The approach seems to have some advantages over type directed shrinking, however it was pointed out in this reddit thread that the integrated shrinking…

Damian Nadales
- 4,907
- 1
- 21
- 34
0
votes
1 answer
How to create a value of the Haskell hedgehog type `Gen a`?
I'm trying to write a property based test that is verifying congruence of equality.
To do that I need to be able to run it by providing 2 values of the type Gen a:
fun_cong_equality
:: forall m a
. (Monad m, Arg a, Vary a, Eq a, Show a)
=> Gen a
->…

Răzvan Flavius Panda
- 21,730
- 17
- 111
- 169
0
votes
1 answer
How to use MonadUnliftIO or MonadBaseControl with Hedgehog?
I've got a "test wrapper" that creates a DB table with a random name for each test (so that they don't interfere with each other), and ensures that the table is dropped when the test ends:
-- NOTE: The constraint on `m` may be incorrect because I…

Saurabh Nanda
- 6,373
- 5
- 31
- 60
0
votes
0 answers
Hedgehog not respecting withTest
I'm using Hedgehog with tasty-discover and have written a simple class that implements Square 2D coordinates/vectors. I've then written the following test. Only problem is, it only seems to run one test, which runs extremely quickly, leading me to…

Julian Birch
- 2,605
- 1
- 21
- 36