Re: [Haskell-cafe] about openTempFile

2008-09-17 Thread Dougal Stanton
On Wed, Sep 17, 2008 at 1:17 PM, Manlio Perillo [EMAIL PROTECTED] wrote: The Python tempfile module, as an example, implements a wrapper around mkstemp function that does exactly this, and the code is portable; on Windows it uses O_TEMPORARY_FILE flag, on POSIX systems the file is unlink-ed as

Re: [Haskell-cafe] about openTempFile

2008-09-17 Thread David Roundy
On Wed, Sep 17, 2008 at 02:10:56PM +0100, Dougal Stanton wrote: On Wed, Sep 17, 2008 at 1:17 PM, Manlio Perillo [EMAIL PROTECTED] wrote: The Python tempfile module, as an example, implements a wrapper around mkstemp function that does exactly this, and the code is portable; on Windows it

Re: [Haskell-cafe] about openTempFile

2008-09-17 Thread Manlio Perillo
Dougal Stanton ha scritto: On Wed, Sep 17, 2008 at 1:17 PM, Manlio Perillo [EMAIL PROTECTED] wrote: The Python tempfile module, as an example, implements a wrapper around mkstemp function that does exactly this, and the code is portable; on Windows it uses O_TEMPORARY_FILE flag, on POSIX

Re: [Haskell-cafe] about openTempFile

2008-09-17 Thread Don Stewart
manlio_perillo: Hi. After reading the chapter about IO in the Real Word Haskell book, I have noted that there is no support for opening a temporary file that will be automatically removed at program termination. The Python tempfile module, as an example, implements a wrapper around

Re: [Haskell-cafe] about openTempFile

2008-09-17 Thread Don Stewart
manlio_perillo: Dougal Stanton ha scritto: On Wed, Sep 17, 2008 at 1:17 PM, Manlio Perillo [EMAIL PROTECTED] wrote: The Python tempfile module, as an example, implements a wrapper around mkstemp function that does exactly this, and the code is portable; on Windows it uses O_TEMPORARY_FILE

RE: [Haskell-cafe] about openTempFile

2008-09-17 Thread Mitchell, Neil
But since GHC does not implement such a function, I was curious to know why it don't even implement a function that make sure the temporary file is removed. Because it is two lines to write, so no one has yet proposed it for the base library. Map is 2 lines, but we have that as a

Re: [Haskell-cafe] about openTempFile

2008-09-17 Thread David Roundy
On Wed, Sep 17, 2008 at 04:51:07PM +0100, Mitchell, Neil wrote: But since GHC does not implement such a function, I was curious to know why it don't even implement a function that make sure the temporary file is removed. Because it is two lines to write, so no one has yet

Re: [Haskell-cafe] about openTempFile

2008-09-17 Thread Brandon S. Allbery KF8NH
On 2008 Sep 17, at 8:17, Manlio Perillo wrote: The Python tempfile module, as an example, implements a wrapper around mkstemp function that does exactly this, and the code is portable; on Windows it uses O_TEMPORARY_FILE flag, on POSIX systems the file is unlink-ed as soon as it is created

Re: [Haskell-cafe] about openTempFile

2008-09-17 Thread Manlio Perillo
David Roundy ha scritto: [...] In particular, the code Don quoted is incorrect depending on which import statements are used. If we assume that the default is the bracket available in Haskell 98, then it is definitely incorrect. It also doesn't behave properly in the presence of signals or

Re: [Haskell-cafe] about openTempFile

2008-09-17 Thread David Roundy
On Wed, Sep 17, 2008 at 10:11:28PM +0200, Manlio Perillo wrote: David Roundy ha scritto: [...] In particular, the code Don quoted is incorrect depending on which import statements are used. If we assume that the default is the bracket available in Haskell 98, then it is definitely incorrect.