[Haskell] Weaving the Web with Haskell

Graham Klyne gk at ninebynine.org
Wed Jan 28 12:36:31 EST 2004

For the past week or so, I've been wrestling with various bits of Haskell 
libraries trying to get an XML parser running under Windows.  Each time I 
think I've resolved a problem, another pops up to take its place.  So I 
felt it was a good time to stand back and review my goals and approach.


I believe that Haskell has a number of characteristics that make it 
eminently suitable for prototyping and deploying a range of web 
technologies.  My own interest is in the Semantic Web area, but I think 
Haskell could also be usefully applied to Web Services and other web 
applications, and (as a language) potentially stands up well against the 
likes of Java and Python.   The Web is spawning a host of little (and 
not-so-little) languages, and Haskell seems to have the right features to 
handle these in a clean, principled fashion.  This is my working premise.

Contemporary web applications are largely based on XML and HTTP.  So a 
prerequisite for widespread use of any language for Web applications is 
good XML and HTTP support.  Given the right libraries, Haskell could make 
handling these aspects very straightforward.  But there seems to be a lack.


Ideally, I think that the following requirements should be satisfied:
- full XML parser supporting all features of the current XML core and 
namespace specifications.
- full HTTP support, including content negotiation, redirection, 
read/write, GET, HEAD, PUT, POST, etc.
- available across all Haskell compilers on all platforms

Practically, I think the following would be enough to make a big 
difference, and this is what I'm currently looking for:
- XML support, not necessary validating, but accepting full XML syntax and 
supporting including internal entity definitions and substitution and XML 
- capability to access the representation of a Web Resource using HTTP GET
- supported uniformly by GHC and Hugs, on Linux and Windows platforms.

Where I am

I have been trying to use the HXML toolbox, because I understand it's the 
only XML parser for Haskell that supports XML namespaces.  Unfortunately, 
it seems to be rather dependent on older versions of GHC (unless I'm 
missing something), which is making it more problematic to adopt than I had 
hoped.  Other packages, such as HaXml, seem to be more portable but as far 
as I'm aware are missing key functionality (notably XML namespace support).

Looking forward

I shall plug away for a little while with HXML toolbox -- currently I'm 
stuck for an MD5 library module -- and it may be that, with a little help, 
I'll win through:  if I get it running with Hugs under Windows, I'll 
consider that to be significant progress.

But maybe I'm missing a trick:  is there other software I should be 
considering to satisfy my goals?  Constructive suggestions would be welcome.

I'm anticipating that as the library infrastructure project settles, we'll 
see some effort to move more of this kind of support code into a common and 
generally usable function library.  I hope I shall be able to contribute to 
such an outcome.

I suggest that the XML and HTTP support I've mentioned would be a key 
enabler to allow Haskell to be more widely used for real-world projects as 
well as academic research into language design issues (which currently 
seems to be its strongest developer community interest).


Graham Klyne
For email:

More information about the Haskell mailing list