There is a little program of which behavior I don't understand.
If it's not a bug, could you explain it to me ?

> filename = "data.txt"

> bug :: IO()
> bug =
>   do db <- readFile filename
>      --putStr (show db)
>      writeFile filename ("abc"++db)

This program runs perfectly well. But if the line with the 'putStr' is
removed,  then the resulting file  is incorrect:  instead of writing s
and then copy what was in  the file,   only  s  is written,  as if the
variable  db' was empty, whatever was in the file.


  Else, thanks for your job ! Haskell and Hugs, are really great tools.


Pierre Lemaire



Reply via email to