[Haskell] ANNOUNCE: Dr Haskell 0.1

Neil Mitchell ndmitchell at gmail.com
Sat Sep 23 10:08:18 EDT 2006


Hi Haskell,

This is the first release of Dr Haskell, a tool to help suggest
improvements to your code.

GETTING DR HASKELL

See http://www-users.cs.york.ac.uk/~ndm/projects/drhaskell.php for
details on how to download and install the program. There are prebuilt
Windows binaries. This project requires Yhc to be installed and
working, of which there are also prebuilt binaries (see the above web
page for pointers). This program should work fine on Linux/Mac etc,
provided you first have Yhc installed.

AN EXAMPLE SESSION

Imagine you have a program, and somewhere deep inside the program it
has the expression:

take 5 (repeat '!')

An experienced Haskell user might realise that this is in fact
replicate, but a beginner has no way of discovering this function for
themselves, besides reading the standard libraries!

Put that definition in a Haskell source file, say Test.hs, then run:

> drhaskell Test.hs
I can apply use_replicate in check_elem (5:10-6:80)

Dr Haskell gives a suggestion (use_replicate) to a specific function
(check_elem) and a given source location (line 5, column 10)

Of course, they might have written take 5 $ repeat '!', or take n .
repeat, or quite a few other variations. Dr Haskell can see through
these things nicely.

Of course, Dr Haskell can make more powerful suggestions, for example:

if f x then 4 else if g x then 4 else primes !! 10

And Dr Haskell will suggest you use f x || g x instead

The hints are isolated from the program, and can be easily changed by
the user. More hint patches are most welcome. See
http://www.cs.york.ac.uk/fp/darcs/drhaskell/Hints.hs for a list of the
hints currently available in the code.

LIMITATIONS

Requires a working copy of Yhc. You must first have your program/file
successfully compiling with Yhc. Once you have got over the admin side
(compiling etc, invoking correctly), the actual hint algorithm is
pretty robust.

Bug reports/suggestions/patches most welcome.

YHC INFORMATION

Home page: http://haskell.org/haskellwiki/Yhc
Build details: http://haskell.org/haskellwiki/Yhc/Building
Windows snapshot: http://haskell.org/haskellwiki/Yhc/Snapshots

If Yhc won't build for you, or you have other difficulties, please bug
the Yhc Team on their mailing list, yhc -at- haskell -dot- org.

Thanks

Neil


More information about the Haskell mailing list