nw-pbt-haskell
FeaturedHaskell property-based testing with QuickCheck and Hedgehog frameworks
Testing & QA 636 stars
68 forks Updated today MIT
Install
Quality Score: 98/100
Stars 20%
Recency 20%
Frontmatter 20%
Documentation 15%
Issue Health 10%
License 10%
Description 5%
Skill Content
# PBT Haskell -- QuickCheck + Hedgehog
## Framework Selection
| Framework | Shrinking | Stateful | Choose When |
|-----------|-----------|----------|-------------|
| QuickCheck | Type-based (manual) | Limited (open-source) | Default for most projects. Universal ecosystem support. |
| Hedgehog | Integrated (automatic) | Yes (parallel too) | Need automatic shrinking composition or parallel stateful testing |
QuickCheck is the original PBT framework (2000). Hedgehog is the modern alternative with better shrinking.
## Quick Start (QuickCheck)
```haskell
import Test.QuickCheck
prop_reverse_involutory :: [Int] -> Bool
prop_reverse_involutory xs = reverse (reverse xs) == xs
-- Run: quickCheck prop_reverse_involutory
-- Or in test suite: testProperty "reverse" prop_reverse_involutory
```
## Generator Cheat Sheet (QuickCheck)
### Via Arbitrary Type Class
```haskell
arbitrary :: Gen Int -- any Int
arbitrary :: Gen String -- any String
arbitrary :: Gen [Int] -- any list of Ints
arbitrary :: Gen Bool
-- Custom Arbitrary
data Color = Red | Green | Blue deriving (Show, Eq)
instance Arbitrary Color where
arbitrary = elements [Red, Green, Blue]
shrink Red = []
shrink _ = [Red]
```
### Gen Combinators
```haskell
choose (0, 100) -- bounded int
elements [1, 2, 3] -- pick from list
oneof [gen1, gen2] -- union
frequency [(80, gen1), (20, gen2)] -- weighted
listOf arbitrary -- list
listOf1 arbitrary -- non-e...
Details
- Author
- nWave-ai
- Repository
- nWave-ai/nWave
- Created
- 9 months ago
- Last Updated
- today
- Language
- Python
- License
- MIT
Similar Skills
Semantically similar based on skill content — not just same category
Testing & QA Featured
nw-pbt-dotnet
.NET property-based testing with FsCheck, CsCheck, and fsharp-hedgehog frameworks
636 Updated today
nWave-ai Testing & QA Featured
nw-pbt-rust
Rust property-based testing with proptest, quickcheck, and bolero frameworks
636 Updated today
nWave-ai Testing & QA Featured
nw-pbt-go
Go property-based testing with rapid and gopter frameworks
636 Updated today
nWave-ai