[Haskell-cafe] ANN: Extrapolate: generalized QuickCheck-style counterexamples.

Rudy Matela rudy at matela.com.br
Wed Oct 17 00:26:06 UTC 2018

Hello Haskell-Café,

A new version of Extrapolate is out: v0.3.5.  Since the last announcement
here improvements have been made in performance and stability.  In
addition, the IFL revised accepted paper is finally out (see end of the

For those who don't know Extrapolate, it is a property testing library
capable of reporting generalized counterexamples to properties.  Here is a
simple example:

	$ ghci
	> import Test.Extrapolate
	> import Data.List (nub)
	> check $ \xs -> nub xs == (xs :: [Int])
	*** Failed! Falsifiable (after 3 tests):


	Conditional Generalization:
	x:xs  when  elem x xs

The above property not only fails for the list `[0,0]` but also for any
list of the form `x:x:_`.  This hints that the above property fails
whenever the argument list has repeated elements.

The above example is perhaps artificial: the property is obviously wrong!
But it does illustrate what Extrapolate is able to produce: aside from the
fully defined counterexample it reports a conjectured generalization with
some parts of the counterexample replaced by variables or holes.

Generalization is particularly helpful when dealing with bigger
counterexamples.  The following fully-defined counterexample to one of
XMonad's properties

	StackSet { current = Screen { workspace = Workspace { tag = 0, layout
	= 0, stack = Just ( Stack { focus = 'a', up = "", down = "" } ) },
	screen = 0, screenDetail = 0 }, visible = [], hidden = [], floating =
	fromList [] }

is reported by Extrapolate alongside a much simpler generalization:

	StackSet (Screen (Workspace _ _ (Just _)) _ _) _ _ _

Full details for the above example are given in the research paper.

Get Extrapolate with:

	$ cabal install extrapolate

See the Haddock documentation and the project README for more details.

I'm interested in input from the Haskell community about Extrapolate.
Please let me know if it works (or not) for you.


* Research paper (link 1): https://matela.com.br/paper/extrapolate.pdf
* Research paper (link 2): https://dl.acm.org/citation.cfm?id=3205371
* Hackage:                 https://hackage.haskell.org/package/extrapolate
* GitHub:                  https://github.com/rudymatela/extrapolate

Best Regards,

More information about the Haskell-Cafe mailing list