polytropos-quickcheck: QuickCheck generators and slot-indexed shrinkers for polytropos open rows

[ library, testing ] [ Propose Tags ] [ Report a vulnerability ]

Property-based testing integration connecting polytropos open records and variants to QuickCheck.

Provides Test.QuickCheck.Arbitrary instances for Polytropos.Record and Polytropos.Variant: records generate values heterogeneously via Polytropos.Core.AllFields and shrink slot-by-slot (avoiding Cartesian product blowup); variants pick uniformly across constructor tags and shrink strictly within the active constructor branch.

Start at the front door module Polytropos.QuickCheck for complete documentation, shrink semantics, and worked examples.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.2
Change log CHANGELOG.md
Dependencies base (>=4.14 && <5), polytropos-core (>=0.1 && <0.2), polytropos-plugin (>=0.1 && <0.2), QuickCheck (>=2.14 && <2.19) [details]
License (EUPL-1.2 OR Apache-2.0)
Author Nadia Yvette Chambers
Maintainer nadia.yvette.chambers@ik.me
Uploaded by nyc at 2026-10-21T21:34:29Z
Category Testing
Home page https://github.com/NadiaYvette/polytropos
Bug tracker https://github.com/NadiaYvette/polytropos/issues
Source repo head: git clone https://github.com/NadiaYvette/polytropos(packages/polytropos-quickcheck)
Distributions
Downloads 3 total (3 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2026-10-21 [all 1 reports]

Readme for polytropos-quickcheck-0.1.0.2

[back to package description]

polytropos-quickcheck

Property-based testing integration connecting polytropos open records and variants to QuickCheck.

Overview

polytropos-quickcheck provides Arbitrary instances for Record and Variant, enabling automated test generation and slot-by-slot shrinking.

Features

  • Slot-by-Slot Shrinking: Shrinks records one field at a time without Cartesian product state space blowup.
  • Branch-Preserving Variant Shrinking: Generates constructor variants uniformly and shrinks values strictly within the active constructor branch.
  • Heterogeneous Generation: Derives generators across all fields using AllFields Arbitrary r.

Quick Example

{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE OverloadedRecordDot #-}
{-# LANGUAGE TypeApplications #-}
{-# OPTIONS_GHC -fplugin=Polytropos.Plugin #-}

import Test.QuickCheck
import Polytropos
import Polytropos.QuickCheck

type User = Record '["id" ':= Int, "name" ':= String, "active" ':= Bool]

-- Slot-indexed shrinking shrinks one field at a time without Cartesian explosion
prop_roundtrip :: Property
prop_roundtrip = forAll (arbitrary @User) \u ->
  u.id == u.id && not (null u.name)

License

Dual-licensed under EUPL-1.2 OR Apache-2.0.