Hugs plugin, Haskell Browser

Manuel M. T. Chakravarty chak@cse.unsw.edu.au
Thu, 14 Mar 2002 15:05:34 +1100


"Robert Giegerich" <robert@TechFak.Uni-Bielefeld.DE> wrote,

> I often use Haskell demos in teaching algorithms. The problem is that this
> does not integrate well with the rest of the material, e.g. lecture
> notes or slides in PDF or HTML. I'd like to integrate explanations and
> demos and explorative changes to algorithms. This needs better support.
> 
> Is there something like a Hugs plugin for Netscape?

What I am doing is to run XEmacs and a PostScript previewer
(with the slides) on two different virtual desktops.  I can
switch between both desktops with a single keystroke.  In
XEmacs, I am using the Haskell mode from

  http://haskell.org/haskell-mode/

It does markup Haskell code quite nicely using colour and
allows me to run GHCi as a background process - ie, my
XEmacs window is split into two halfs with the font-locked
source on top and my GHCi session on the bottom.  In the
first year programming course that I teach, I always develop
and debug programs in front of the class (with maybe some
definitions pre-defined for larger examples).  In fact, I
regard it as a big advantage of using Haskell for first-year
teaching that this is possible (it's difficult with a more
verbose language).  I have run student surveys asking
students to comment on the lecture and the feedback has been
very positive.  In fact, the vast majority of students has
rated the described approach as by far superior to the
traditional chalk&talk approach.

> Is there something like a Haskell source browser producing XML or HTML?

Again, XEmacs with the above mentioned Haskell mode can do
it.  Just execute the function `htmlize-buffer' on a buffer
containing the Haskell source.  As an example for the
generated output, have a look at

  http://www.cse.unsw.edu.au/~chak/haskell/gtk/BoolEd.html

The detailed choice of colours is, of course, adjustable.
At least on a Unix machine, I am quite sure you can use
XEmacs also in batch mode to generate the HTML (eg, as part
of a Makefile), but I haven't actually used it that way yet.

Cheers,
Manuel

PS: I am doing all this on a laptop running Linux, but I
    think the virtually same setup should be possible on a
    Win32 box as XEmacs is available for that platform,
    too.