[Haskell-cafe] Exclusive mode in openFile

Gracjan Polak gracjanpolak at gmail.com
Tue Jun 28 19:56:33 CEST 2011

Max Bolingbroke <batterseapower <at> hotmail.com> writes:
> This behaviour is part of the Haskell 98 specification (section
> 21.2.3, http://www.haskell.org/onlinereport/io.html):

Thanks for the explanation. Such sharing behavior should be mentioned in


What was the rationale behind such strict non-sharing policy?

Anyway, where do I find an 'openFileShared' function? Packages unix/Win32 do not
have obvious leads...

> """
> Implementations should enforce as far as possible, at least locally to
> the Haskell process, multiple-reader single-writer locking on files.
> That is, there may either be many handles on the same file which
> manage input, or just one handle on the file which manages output. If
> any open or semi-closed handle is managing a file for output, no new
> handle can be allocated for that file.
> """
> I've been bitten by this before and don't like it. It would be
> possible for GHC to enforce Unix semantics instead (there are
> appropriate flags to CreateFile that get those semantics on Windows),
> which would support more use cases. This change would have to be
> carefully thought through, and the report would have to be amended.
> Cheers,
> Max


More information about the Haskell-Cafe mailing list