I have made a small modification to my winhugs which allows you to load files into winhugs and execute Hugs expressions within the comfort of your editor. The convenience may appear small, but prior to the change, I found the typing/clicking involved in switching windows and reloading my Haskell program into winhugs every time I changed it irritating after the first hundred times!
The program mod is simple: while waiting for user input, every half-second
winhugs checks to see if the modification time of the file
"/Program Files/Hugs98/autoload" changed. If so, winhugs executes the
file, just as if the user had typed in the text in the file.
Thus a makefile (executed from within your editor) could be
/progra~1/hugs98/autoload: foo1.hs foo2.hs foo3.hs
echo "foo arg1 arg2" >/progra~1/hugs98/autoload
touch /progra~1/hugs98/autoload
or more simply, when you want winhugs to execute your program just
re-save autoload from within your editor (with the standard Hugs
options enabled "i import chasing" and "A Auto load files").
I am one of those people who take an non-mouse EMACS-centered view
of the world and like to do everything from within EMACS. But once in a
while it is nice to try out things directly in winhugs. With this mod and
running EMACS and winhugs side by side, I get the best of both
worlds. Invoking EMACS from within winhugs or using runhugs
doesn't work as well for me, as a matter of personal taste.
I have been using this for some time now but was slightly reluctant
to post it to the group because polling a file for
inter-process communication is a bit of hack (even though the
half-second poll takes negligible time). Also, storing
a user-written file in the Hugs98 program directory is poor
practice -- but under Windows there seems to be no other obvious
place to store the autoload file. I didn't want to add an extra
command line flag just to specify the whereabouts of the file.
In spite of theses issues, I can say that in practice autoloading
is nice to use.
One file changed viz. Wintext.c. The diff -u is attached. The source
base for the diff was Nov2002. I tested it under Windows 98.
I hereby give permission for anyone to do anything they like with
the new code.
Stephen
wintext.diff.gz
Description: GNU Zip compressed data
