Anton Moscal <[EMAIL PROTECTED]> wrote:
> > > -- #!/usr/local/bin/runhugs
> > > main =
> > >    catch
> > >         (do c <- getChar; putChar c; main)
> > >         (\e -> (do putChar '$'; putChar '\n'; return ()))

> > > result was very strange: each letter outputted twice, and program
> > > was not terminated. If I compile this program by ghc or nhc98 all
> > > works good.

There's two things going on here:

1) Hugs doesn't implement the Haskell EOF semantics.  Instead it 
   implements the C EOF semantics.  (Can't remember the difference
   but it's in the known bugs section of some documentation somewhere.)

2) Hugs is usually used in an interactive way so its default echoing
   behaviour is different from that used in batch mode systems.  I 
   don't think we ever implemented the IO library routines to change this
   behaviour and I can't remember whether the Haskell report allows 
   a choice of default behaviour.  (Again, details are doumented somewhere.)

   It's not clear whether runhugs (a batch-mode system) should behave 
   exactly the same as Hugs or should be more like the batch-mode systems
   - you could make a case either way.  A flag which selects which
   might be a good idea.  A runhugs-specific environment variable for
   additional flags might also be worthwhile.

--
Alastair Reid        [EMAIL PROTECTED]        http://www2.cs.utah.edu/~reid/

Reply via email to