[Haskell-cafe] Why aren't files flushed at exit?

2011-07-17 Thread Paul Johnson
If you open a file for writing and then exit with output unflushed, then Haskell does not flush the file for you. In ghci the program seems to work, but then when you compile it in ghc it mysteriously fails. I've just been bitten by this, but when I went to the bug tracker I found

Re: [Haskell-cafe] Why aren't files flushed at exit?

2011-07-17 Thread Felipe Almeida Lessa
On Sun, Jul 17, 2011 at 10:41 AM, Paul Johnson p...@cogito.org.uk wrote: If you open a file for writing and then exit with output unflushed, then Haskell does not flush the file for you.  In ghci the program seems to work, but then when you compile it in ghc it mysteriously fails. I've just

Re: [Haskell-cafe] Why aren't files flushed at exit?

2011-07-17 Thread Donn Cave
Quoth Felipe Almeida Lessa felipe.le...@gmail.com, On Sun, Jul 17, 2011 at 10:41 AM, Paul Johnson p...@cogito.org.uk wrote: If you open a file for writing and then exit with output unflushed, then Haskell does not flush the file for you.  In ghci the program seems to work, but then when you

Re: [Haskell-cafe] Why aren't files flushed at exit?

2011-07-17 Thread Felipe Almeida Lessa
On Sun, Jul 17, 2011 at 1:40 PM, Donn Cave d...@avvanta.com wrote: The use of withFile on the main function is a good practice in Haskell only because of this defect in the GHC library implementation. Well, I've always closed my handles on all languages I've programmed. Actually, now I remember

Re: [Haskell-cafe] Why aren't files flushed at exit?

2011-07-17 Thread Jack Henahan
Is there really no question? I question the assertion, for one. Just because a language allows a bad habit doesn't mean it's a feature. Leaving your handles open can lead to unpredictable results, which is somewhat anathema to the idea of correct programs, unless broken features are part of

Re: [Haskell-cafe] Why aren't files flushed at exit?

2011-07-17 Thread Brandon Allbery
On Sun, Jul 17, 2011 at 18:03, Jack Henahan jhena...@uvm.edu wrote: Is there really no question? I question the assertion, for one. Just because a language allows a bad habit doesn't mean it's a feature. Leaving your handles open can lead to unpredictable results, which is somewhat anathema