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

Paul Brauner paul.brauner at loria.fr
Sat Sep 18 05:47:07 EDT 2010


Hello,

I just hacked together something I've been talking about a while ago on
that mailing list. It's a program that looks for functions given a set
of input/outputs.

Example session 1:

  brauner at worf:~$ haltavista
  2 2 4
  <EOF>
  
  Prelude (*)
  Prelude (+)
  Prelude (^)
  
Example session 2 (refining previous search):

  brauner at worf:~$ haltavista
  2 2 4
  1 2 3
  <EOF>
  
  Prelude (+)
  
Example session 3 (higher-order functions):

  brauner at worf:~$ haltavista 
  (+1) (+2) (1,1) (2,3)
  <EOF>
  
  Data.Graph.Inductive.Query.Monad (><)


Under the hood, uses:

 - hint for type inference;
 - hoogle to get a list of candidate functions;
 - hint for testing.

Hoogle calling facility has been copy-pasted (and later modified) from
the Yi project.

It's availaible on github (http://github.com/polux/haltavista) and I
plan to release it on hackage as soon as I catch stack overflows that
occur during testing using hint. So far I didn't manage to do it, even
by catching asynchronous exceptions. Every suggestion/help is welcome.

Also, if I got something wrong with the licences (Yi uses GPL-2 and code
is copy-pasted, Hint BSD3 and is linked, Hoogle is called as an external
process, haltavista is GPL-3 for now) please tell me.

Paul


More information about the Haskell-Cafe mailing list