1lab/mikan
13
52
Fork
You've already forked mikan
9

WIP: migrate from QuickCheck to Hedgehog #32

Draft
VojtechStep wants to merge 7 commits from VojtechStep/mikan:feature/hedgehog into main
pull from: VojtechStep/mikan:feature/hedgehog
merge into: 1lab:main
1lab:main
1lab:aliao/occurs-opt
1lab:aliao/rec-con
1lab:fix-license
1lab:aliao/oopsie
1lab:aliao/strengthen-iapply
Contributor
Copy link

I decided to give #23 a try. So far the two main drawbacks I see is the lack of support for generating functions (there is no analogue of Coarbitrary) and having to explicitly universally quantify with property $ do { a <- forAll genA; ... } instead of defining a property with arguments (though I'm like 80% sure this can be solved with some fancy typeclassing and type families a la printf, it just caught me in a very 1AM point of my life)

I decided to give #23 a try. So far the two main drawbacks I see is the lack of support for generating functions (there is no analogue of `Coarbitrary`) and having to explicitly universally quantify with `property $ do { a <- forAll genA; ... }` instead of defining a property with arguments (though I'm like 80% sure this can be solved with some fancy typeclassing and type families a la printf, it just caught me in a very 1AM point of my life)
Author
Contributor
Copy link

I'll take a look at https://dl.acm.org/doi/pdf/10.1145/2430532.2364516 for function generation and see how annoying it is without typeclasses, to keep in line with the way hedgehog does things

I'll take a look at https://dl.acm.org/doi/pdf/10.1145/2430532.2364516 for function generation and see how annoying it is without typeclasses, to keep in line with the way hedgehog does things

It is tempting to do some typeclass trickery, but it plays out rather poorly. Property testing is extremely sensitive to the distributions you choose on the inputs, and classes like Arbitrary funnel you down a path where there’s a single blessed distribution per type. This is why I suggested moving to hedgehog in the first place; there’s much finer grained tools for doing per-test case generators.

It is tempting to do some typeclass trickery, but it plays out rather poorly. Property testing is extremely sensitive to the distributions you choose on the inputs, and classes like Arbitrary funnel you down a path where there’s a single blessed distribution per type. This is why I suggested moving to hedgehog in the first place; there’s much finer grained tools for doing per-test case generators.
Author
Contributor
Copy link

What I had in mind was purely code shuffling, something that would turn a MonadTest m => a -> b -> ... -> m () into a Gen a -> Gen b -> ... -> Property. That would handle the quantification for you while still giving you complete control over the distributions. I just want to reduce the boilerplate visible in Internal.Utils.VarSet

What I had in mind was purely code shuffling, something that would turn a `MonadTest m => a -> b -> ... -> m ()` into a `Gen a -> Gen b -> ... -> Property`. That would handle the quantification for you while still giving you complete control over the distributions. I just want to reduce the boilerplate visible in Internal.Utils.VarSet
VojtechStep force-pushed feature/hedgehog from c8deaa5539
Some checks are pending
ci/woodpecker/pr/test Pipeline is pending approval
to d00319a28f
Some checks are pending
ci/woodpecker/pr/test Pipeline is pending approval
2026年04月26日 00:43:39 +02:00
Compare
VojtechStep force-pushed feature/hedgehog from d00319a28f
Some checks are pending
ci/woodpecker/pr/test Pipeline is pending approval
to 4193aa47cf 2026年04月29日 23:59:58 +02:00
Compare
VojtechStep force-pushed feature/hedgehog from 4193aa47cf to 1eeb37bf22
All checks were successful
ci/woodpecker/pr/test Pipeline was successful
2026年05月02日 00:12:10 +02:00
Compare
VojtechStep force-pushed feature/hedgehog from 1eeb37bf22
All checks were successful
ci/woodpecker/pr/test Pipeline was successful
to 7e722a1e33
All checks were successful
ci/woodpecker/pr/test Pipeline was successful
2026年05月08日 16:50:55 +02:00
Compare
VojtechStep force-pushed feature/hedgehog from 7e722a1e33
All checks were successful
ci/woodpecker/pr/test Pipeline was successful
to 5896e88ad2
Some checks failed
ci/woodpecker/pr/test Pipeline failed
2026年05月09日 19:46:04 +02:00
Compare
First-time contributor
Copy link

There's an existing function generation library for Hedgehog (https://hackage.haskell.org/package/hedgehog-fn), but it seems to be lacking in instances. As far as I understand there's no reason not to use a typeclass for "Coarbitrary" because it doesn't affect the distribution of the function generation, though I guess it could affect the shrinking behavior.

There's an existing function generation library for Hedgehog (https://hackage.haskell.org/package/hedgehog-fn), but it seems to be lacking in instances. As far as I understand there's no reason not to use a typeclass for "Coarbitrary" because it doesn't affect the distribution of the function generation, though I guess it could affect the shrinking behavior.
VojtechStep force-pushed feature/hedgehog from 5896e88ad2
Some checks failed
ci/woodpecker/pr/test Pipeline failed
to 4877c29d30
All checks were successful
ci/woodpecker/pr/test Pipeline was successful
2026年05月13日 00:41:26 +02:00
Compare
VojtechStep force-pushed feature/hedgehog from d413334ee2
Some checks failed
ci/woodpecker/pr/test Pipeline failed
to 99d7bac604
Some checks failed
ci/woodpecker/pr/test Pipeline failed
2026年06月21日 01:32:05 +02:00
Compare
Some checks failed
ci/woodpecker/pr/test Pipeline failed
This pull request has changes conflicting with the target branch.
  • test/Main.hs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u feature/hedgehog:VojtechStep-feature/hedgehog
git switch VojtechStep-feature/hedgehog

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff VojtechStep-feature/hedgehog
git switch VojtechStep-feature/hedgehog
git rebase main
git switch main
git merge --ff-only VojtechStep-feature/hedgehog
git switch VojtechStep-feature/hedgehog
git rebase main
git switch main
git merge --no-ff VojtechStep-feature/hedgehog
git switch main
git merge --squash VojtechStep-feature/hedgehog
git switch main
git merge --ff-only VojtechStep-feature/hedgehog
git switch main
git merge VojtechStep-feature/hedgehog
git push origin main
Sign in to join this conversation.
No reviewers
Labels
Clear labels
1 - scope
language
Backwards-compatible changes to the surface language, such as adding new features.
1 - scope
language change
Breaking changes to a documented part of the surface language. These should be documented and specifically called out in the changelog.
1 - scope
performance
Semantics-preserving performance work.
1 - scope
task
Changes that are not apparent to the user, e.g. developer documentation and refactors, which do not need to be documented.
A: dead-code
Dead code elimination and --save-metas.
A: errors
Reporting of error and warning messages.
A: highlighting
Highlighting during interaction & literate compilation
A: imports
Handling of imports and interface file de/serialization.
A: infra
Iinfrastructure (e.g. CI, developer documentation, the build system, or the repository itself)
A: instance
Instance declarations, arguments, and resolution
A: lhs
LHS checking, coverage checking, and clause compilation
A: modules
Declaration and instantiation of parametrised modules.
A: parallel
Parallel typechecking.
A: positivity
Positivity checking
A: printing
Pretty-printing, display forms, and the wording of diagnostic messages
A: records
Record declarations, record expressions and copattern matching
A: scoping
Scope checking (ConcreteToAbstract)
A: termination
Termination checking
0 - type
bug
Issues describing an incorrect behaviour in the project, typos in the documentation, etc.
0 - type
discussion
An issue raised to gather opinions on a proposed change, or a suggested language change.
0 - type
question
An issue raised to ask a question.
9 - status
duplicate
This issue or pull request already exists.
9 - status
info needed
More information is needed from the submitter to decide how to proceed with the issue report.
9 - status
invalid
The issue report or pull request does not describe an actual bug, or does otherwise does not meet the contributing guidelines.
good first issue
Interested in contributing? Get started here.
upstream
Related to an upstream repository, already reported there
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
1lab/mikan!32
Reference in a new issue
1lab/mikan
No description provided.
Delete branch "VojtechStep/mikan:feature/hedgehog"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?