hedgehog-quickcheck: Use QuickCheck generators in Hedgehog and vice versa.

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.


Use QuickCheck generators in Hedgehog and vice versa.

Hedgehog is a modern property-based testing system, in the spirit of QuickCheck. Hedgehog uses integrated shrinking, so shrinks obey the invariants of generated values by construction.

To get started quickly, see the examples: <https://github.com/hedgehogqa/haskell-hedgehog/tree/master/hedgehog-

[Skip to ReadMe]


Versions0.1, 0.1.1, 0.1.1
Change logCHANGELOG.md
Dependenciesbase (>=3 && <5), hedgehog (>=0.5 && <1.1), QuickCheck (>=2.7 && <2.14), transformers (>=0.4 && <0.6) [details]
AuthorJacob Stanley
MaintainerJacob Stanley <jacob@stanley.io>
Home pagehttps://hedgehog.qa
Bug trackerhttps://github.com/hedgehogqa/haskell-hedgehog/issues
Source repositoryhead: git clone git://github.com/hedgehogqa/haskell-hedgehog.git
UploadedSat May 18 03:42:05 UTC 2019 by JacobStanley




Maintainers' corner

For package maintainers and hackage trustees

Readme for hedgehog-quickcheck-0.1.1

[back to package description]

hedgehog-quickcheck Hackage

Hedgehog will eat all your bugs.

<img src="https://github.com/hedgehogqa/haskell-hedgehog/raw/master/img/hedgehog-logo.png" width="307" align="right"/>

Use QuickCheck generators in Hedgehog and vice versa.


The Hedgehog.Gen.QuickCheck module allows the use of QuickCheck generators inside Hedgehog.

{-# LANGUAGE TemplateHaskell #-}

import           Hedgehog
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Gen.QuickCheck as Gen
import qualified Hedgehog.Range as Range

Once you have your imports set up, you can write a property which mixes QuickCheck and Hedgehog generators together:

prop_reverse :: Property
prop_reverse =
  property $ do
    xs <- forAll $ Gen.list (Range.linear 0 100) (Gen.arbitrary :: Gen Char)
    reverse (reverse xs) === xs

And add the Template Haskell splice which will discover your properties:

tests :: IO Bool
tests =
  checkParallel $$(discover)

You can then load the module in GHCi, and run it:

λ tests
━━━ Test.Example ━━━
  ✓ prop_reverse passed 100 tests.