[Haskell-cafe] [ANN] Speculate: automatically discover properties about Haskell functions generalization of counter-examples

Rudy Matela rudy at matela.com.br
Thu Aug 17 12:35:46 UTC 2017


Hello,

I am happy to announce Speculate.  A library to automatically discover
properties about Haskell functions.

https://hackage.haskell.org/package/speculate

Quick example -- discovering properties about addition and multiplication:

	$ cabal update
	$ cabal install speculate
	$ ghci
	> import Test.Speculate
	> speculate args{constants = [constant "+" (+), constant "*" (*)]}

	_ :: Integer
	(+) :: Integer -> Integer -> Integer
	(*) :: Integer -> Integer -> Integer

	      x + y == y + x
	      x * y == y * x
	(x + y) + z == x + (y + z)
	(x * y) * z == x * (y * z)
	(x + x) * y == x * (y + y)

	x <= x * x

Speculate is similar to QuickSpec, but uses a different algorithm to produce
inequalities and coditional equations -- see README for details.

Speculate is available on both Stackage (nightly) and Hackage.

--
Rudy


More information about the Haskell-Cafe mailing list