Specify a function f by writing a predicate as a boolean-valued expression. You will get functions generalizing the specification.
You can use any Haskell expression returning a Boolean value, provided it does not use let expressions and while clauses.
You can use Prelude functions and some other functions. You can also use the (~=) operator, which works as "nearly equal" for Doubles and containers holding Doubles, and as (==) for other types.
All the printed functions are semantically different from one another: in other words, each newly generated function will not be printed until its difference from all the existing functions is proved by random testing. More and more random numbers are supplied until then. (Note that the difference can be `proved' by random testing, while the equivalence can only be `guessed'. See the PRICAI 2008 paper on my top page.)
If you submit an expression not including f, you will see the results of applying some random arguments. This is supposed to be useful for understanding the expression.
Also, this means that if you submit a nullary expression, it will just be evaluated.
A similar effect can be obtained by clicking on the button left to the resulting expressions, but then, the return values are in text boxes.
If you think some return value is different from your expectation, you can correct it and search again by clicking on the button.
(So, an easy way to use this web tool is to start with only one example predicate, check the return values for some arguments, and then refine your search until you are happy with the result.)
Auto-correction works to some extent. When synthesizing expressions, "=" and "&" are replaced with "~=" and "&&" respectively. When generating input-output examples, parentheses are balanced and unbound variables are bound.
Functions with unused arguments are hidden by default, and they are printed in grey if you check the corresponding check box before search.
If you submit only one word, you will jump to the library documentation page explaining the word (or you will jump to Hoogle if it is unknown to this system:).
You can access this web tool instantly while using your desktop if you are using KDE/TDE.
Put this file in ~/.kde/share/kde4/services/searchproviders/ (for KDE4) and/or ~/.trinity/share/services/searchproviders/ (for TDE).
(You may need to log out and log in again.)
Then, you can make a search by opening the "Run Command..." dialog box (by pressing Alt+F2 or Win+r depending on your keybindings),
and filling the text box with your query starting with "magh:", like "magh: f 3 == [1,2,3]" or "magh: \a -> a*a".
(Please let me know if you know how to do the same thing with Gnome, Windows, etc.)
Limitations, ToDos, and Future Plans
MagicHaskeller is not good at dealing with partial functions.
Synthesized expressions use `drop 1' instead of `tail', and `foldr const (something)' instead of `head'.
Also, the button is not shown if the corresponding expression may be partial,
because the CGI cannot deal with partial functions correctly.
Expressions are synthesized using a limited subset of the base standard library. Currently, values mainly from the Standard Prelude and module Data.List are used. Also, Float and Integer are not recognized for now. (You can still use Int, Char, Bool, lists, tuples, Maybe, Double, etc.)
Most expressions, including Char or String literals, cannot be synthesized. I have an idea of enabling use of them by extracting literals from the query expressions, but that is not implemented yet.
In order to preserve the stability of the server system, program search stops at some point, and as a result the currently-running server does not synthesize expressions with more than (about) 6 function applications in the eta-long normal form. (I say "about" 6, because internally one primitive function can consist of some functions and some others may have lower priority. Also, postprocessing can change the number of applications.)
There are some cases where the feature of evaluating expressions (with/without random arguments) fails to show a correct HTML.
Currently, it is fragile to partial functions,
such as init and enumFromThenTo.
(`init ' causes an error, and `enumFromThenTo 1 1 2' is infinite.)
Also, type ambiguity may sometimes cause a similar problem.
This problem can usually be avoided by adding type signatures adequately.
If you experience a problem, please press the Back button of your browser.
Also, because this problem does not occur with the combination of GHC-7.6.3 and Mueval-0.9.1,
if you really hate the problem, you can use this CGI instead.
Then, you will have to add type signatures in more cases, though, due to the change in the specification of the IncoherentInstances language extension.
It would be useful if the CGI frontend had the ability to show an example argument list with which two functions differ.
If you are using Konqueror or some similar web browser, this can somewhat be achieved by dividing the window vertically and clicking their buttons.
The error messages (like those for type errors made by the user) could be printed in better ways,
maybe like the `Do you mean...?' functionality provided by Google.
Maybe some BTS should be introduced instead of using this kind of ToDo list. Indeed, there are much more ToDos that are not enumerated here.
Library (and Stand-alone) Versions
Here is a link to the old web page for its library (and stand-alone) versions.
Please note that they are not updated very often.