Interpret haskell within haskell.
20 Dec 2002 12:24:24 +0000
John Hughes <firstname.lastname@example.org> writes:
> When I want to do this kind of thing, I use hugs as a back-end. I
> write the expressions I want to evaluate, or whatever, to a file of
> hugs commands, and then run
> system "hugs <hugsinput >hugsoutput"
> then read and process the output (choose your favourite filenames,
> /tmp/... or whatever).
A variant on this idea would be to use the 'Hugs Server API'. We used
to publicise this API on the Hugs pages but it seems to have gone
missing so you can grab a copy from:
You'll find a more up to date version in the Hugs distribution in
The server API provides an interface for use from C programs but
Haskell's foreign function interface makes it a snap to access that
There's only one caveat: you will have to use GHC or NHC to use the
Hugs server; you can't use Hugs to use the Hugs server. Bummer!
Alastair Reid email@example.com
Reid Consulting (UK) Limited http://www.reid-consulting-uk.ltd.uk/alastair/