[Haskell-cafe] haltavista - look for functions by example

Paul Brauner paul.brauner at loria.fr
Sun Sep 19 14:29:05 EDT 2010

That's a great idea!

In the same vein, have you had a look at quickspec by Koen Claessen,
Nicholas Smallbone and John Hughes?


This reminds me of another idea, suggested by Jun inoue: look for
functions by specification instead of examples.

I will try your idea ASAP. As you say, I think that might be helpful for
beginners, as you suggest, or even when you're not a beginner anymore
but you start using a new library.


On Sun, Sep 19, 2010 at 07:41:21PM +0200, Roel van Dijk wrote:
> Very interesting!
> It got me thinking: if you combine this with the Arbitrary class [1]
> of QuickCheck you can use it check if you have defined a function that
> is "equal" to an already defined function.
> Let's say I write the following function:
>   intMul ∷ Integer → Integer → Integer
>   intMul x 0 = 0
>   intMul x n = x + intMul x (n - 1)
> No you can automatically apply this function to a list of 100
> generated inputs to get a list of input output pairs. Feed this into
> haltavista and it should tell you that you can replace your definition
> with Prelude (*). While such an observation is certainly not a proof
> it is still useful.
> It would be a nice addition to a Haskell editor. Especially for those
> new to the language.
> Regards,
> Roel
> 1 - http://hackage.haskell.org/packages/archive/QuickCheck/2.3/doc/html/Test-QuickCheck-Arbitrary.html

More information about the Haskell-Cafe mailing list