I don't have very much luck with this question in c.l.f. So I'll try it
here. 

I tried to run a simple program form the book "The craft of Functional
Programming" from Simon Thompson, page 392f. Here's my source
#!/usr/local/bin/runhugs
import System
import IO

main :: IO ()
main = while 
           (do res <- IO.hugsIsEOF;
                return (not res))
           (do line <- getLine;
                putStrLn line)
                         
while :: IO Bool -> IO() -> IO()
while test action = do condition <- test;
                      if condition then 
                         do action;
                            while test action
                      else return ()

The only change in my example is the use of IO.hugsIsEOF. I looked inot
IO.hs and isEOF is commented out and the comment says not yet
implemented so I use this. But now I can't quit the program. I work
under Linux and STRG+D is normally EOF but it won't stop on typing that
in. The other point is that if I use a file the file is printed to
standard output and a lot of garbage too and then runhugs is killed
because of faults in space reclamation.

So could s.o. give me a hint how I can get this program running?



Regards
Friedrich


Reply via email to