[cc list reduced to hugs-bugs]

> What's the appropriate forum for this? I can make up a suggested mapping 
> if it's helpful. But I know little about Haskell. Does ghc have some
> mapping already in place?

It must do since they have an implementation - just a question of
finding the (unpublished) docs (or the source).

Or, we can wait for the great Hugs-GHC library merger to happen and 
Hugs automatically inherits GHC's mapping.

> Taking my cheesy little program as a case study, there are two clear
> impracticalities in the Hugs implementation: this error handling
> issue, and the fact that strings are written with a write() for every
> character. Both of those are show-stoppers for "practical" applications.

Note that laziness is in partial conflict with efficient use of write.
Suppose I write:

  putStr ("abc" ++ show (1/0))

The obvious implementation (ie Hugs) would output 3 characters then an
error message.  If you replace 1/0 with an infinite loop, it outputs 3
characters and then halts.

The efficient implementation would write the 3 characters into a buffer
then go into a loop (or whatever) and you wouldn't see any output.

If I remember GHC correctly, the compromise approach is to flush the
buffer on every newline or every N characters (where N is in the range
50-100).

> The error thing is the most important since presumably "practical" apps
> are compiled for production use instead of using Hugs, but the errno has
> to be fixed so you can test using the interpreter, then compile later, and
> get the same semantics in both cases.

The Hugs-GHC folk have been working hard to improve compatability -
but their most demanding user (that's you Conal) doesn't use the IO
library much.  I think more reports like yours are what they're
needing.

Alastair

Reply via email to