quickspec: Equational laws for free!

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

QuickSpec takes your Haskell code and, as if by magic, discovers laws about it. You give QuickSpec a collection of Haskell functions; QuickSpec tests your functions with QuickCheck and prints out laws which seem to hold.

For example, give QuickSpec the functions reverse, ++ and [], and it will find six laws:

reverse [] == []
xs ++ [] == xs
[] ++ xs == xs
reverse (reverse xs) == xs
(xs ++ ys) ++ zs == xs ++ (ys ++ zs)
reverse xs ++ reverse ys == reverse (ys ++ xs)

QuickSpec can find equational laws as well as conditional equations. All you need to supply are the functions to test, as well as Ord and Arbitrary instances for QuickSpec to use in testing; the rest is automatic.

For information on how to use QuickSpec, see the documentation in the main module, QuickSpec. You can also look in the examples directory, for example at Lists.hs, IntSet.hs, or Parsing.hs. To read about how QuickSpec works, see our paper, Quick specifications for the busy programmer.


[Skip to Readme]

Modules

[Index] [Quick Jump]

  • QuickSpec
    • QuickSpec.Internal
      • QuickSpec.Internal.Explore
        • QuickSpec.Internal.Explore.Conditionals
        • QuickSpec.Internal.Explore.Polymorphic
        • QuickSpec.Internal.Explore.Schemas
        • QuickSpec.Internal.Explore.Terms
      • QuickSpec.Internal.Haskell
        • QuickSpec.Internal.Haskell.Resolve
      • QuickSpec.Internal.Parse
      • QuickSpec.Internal.Prop
      • QuickSpec.Internal.Pruning
        • QuickSpec.Internal.Pruning.Background
        • QuickSpec.Internal.Pruning.PartialApplication
        • QuickSpec.Internal.Pruning.Twee
        • QuickSpec.Internal.Pruning.Types
        • QuickSpec.Internal.Pruning.UntypedTwee
      • QuickSpec.Internal.Term
      • QuickSpec.Internal.Terminal
      • QuickSpec.Internal.Testing
        • QuickSpec.Internal.Testing.DecisionTree
        • QuickSpec.Internal.Testing.QuickCheck
      • QuickSpec.Internal.Type
      • QuickSpec.Internal.Utils

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.9, 0.9.1, 0.9.2, 0.9.3, 0.9.4, 0.9.5, 0.9.6, 2, 2.1, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.1.5, 2.2
Dependencies base (>=4.7 && <5), constraints, containers, data-lens-light (>=0.1.1), dlist, QuickCheck (>=2.14.2), quickcheck-instances (>=0.3.16), random, spoon, template-haskell, transformers, twee-lib, uglymemo [details]
License BSD-3-Clause
Copyright 2009-2019 Nick Smallbone
Author Nick Smallbone
Maintainer nicsma@chalmers.se
Category Testing
Home page https://github.com/nick8325/quickspec
Source repo head: git clone git://github.com/nick8325/quickspec.git -b master
Uploaded by NickSmallbone at 2023-09-21T16:42:56Z
Distributions NixOS:2.2
Reverse Dependencies 3 direct, 0 indirect [details]
Downloads 9782 total (6 in the last 30 days)
Rating 2.0 (votes: 2) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-09-21 [all 1 reports]

Readme for quickspec-2.2

[back to package description]

QuickSpec: equational laws for free!

QuickSpec takes your Haskell code and, as if by magic, discovers laws about it. You give QuickSpec a collection of Haskell functions; QuickSpec tests your functions with QuickCheck and prints out laws which seem to hold.

For example, give QuickSpec the functions reverse, ++ and [], and it will find six laws:

reverse [] == []
xs ++ [] == xs
[] ++ xs == xs
reverse (reverse xs) == xs
(xs ++ ys) ++ zs == xs ++ (ys ++ zs)
reverse xs ++ reverse ys == reverse (ys ++ xs)

QuickSpec can find equational laws as well as conditional equations. All you need to supply are the functions to test, as well as Ord and Arbitrary instances for QuickSpec to use in testing; the rest is automatic.

For information on how to use QuickSpec, see the documentation. You can also look in the examples directory, for example at List.hs, IntSet.hs, or Parsing.hs. To read about how QuickSpec works, see our paper, Quick specifications for the busy programmer.