[Haskell-cafe] about openTempFile

David Roundy droundy at darcs.net
Wed Sep 17 13:17:38 EDT 2008


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 proposed 
> > it for the base library. 
> 
> Map is 2 lines, but we have that as a library (1 line in Hugs).
> Otherwise is a whole one lexeme long, but we still provide a library
> function.
> 
> This one is tricky and has lots of edge cases! If its useful, it should
> be in the libraries.

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 keyboard
interrupts (i.e. posix or windows systems).  Of course, a larger
change in the standard libraries is needed in order to solve this
particular problem, so I'd want to agree on a solution for that
problem first.  Which is perhaps a better reason why it's not yet in
the standard libraries: it's perhaps not a good idea to put a function
with such serious issues into the standard libraries.

David


More information about the Haskell-Cafe mailing list