Re: [Haskell-cafe] Exclusive mode in openFile

2011-06-29 Thread Gracjan Polak
Max Bolingbroke batterseapower at hotmail.com writes: http://hackage.haskell.org/packages/archive/unix/2.4.2.0/doc/html/System-Posix-IO.html. Thanks for the link. I tried to use it: Prelude System.Posix.IO fd1 - openFd xxx.tmp WriteOnly (Just 0666) defaultFileFlags Loading package unix-2.4.0.2

Re: [Haskell-cafe] Exclusive mode in openFile

2011-06-29 Thread Gracjan Polak
Gracjan Polak gracjanpolak at gmail.com writes: I'm looking for file locking code in GHC.IO.* modules, but cannot find any. Just for the record: locking code resides in GHC.IO.FD in mkFD which calls lockFile. There is a heavy machinery underneath that is working hard to ensure Report's

Re: [Haskell-cafe] Exclusive mode in openFile

2011-06-29 Thread Felipe Almeida Lessa
On Wed, Jun 29, 2011 at 7:11 PM, Gracjan Polak gracjanpo...@gmail.com wrote: Proper way to handle this is probably to add additional Bool parameter to mkFD, fdToHandle and GHC.IO.FD.openFile that says if Report's semantics should be held or not. Then openFileShared can be build on top of

[Haskell-cafe] Exclusive mode in openFile

2011-06-28 Thread Gracjan Polak
to write to logs, but I'd like to read parts of these logs *from inside same Haskell application*. How do I get around exclusive mode in openFile? -- Gracjan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman

Re: [Haskell-cafe] Exclusive mode in openFile

2011-06-28 Thread Max Bolingbroke
On 28 June 2011 17:50, Gracjan Polak gracjanpo...@gmail.com wrote: It seems I'm not allowed to open same file both for writing and for reading: This behaviour is part of the Haskell 98 specification (section 21.2.3, http://www.haskell.org/onlinereport/io.html): Implementations should enforce

Re: [Haskell-cafe] Exclusive mode in openFile

2011-06-28 Thread Gracjan Polak
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 documentation:

Re: [Haskell-cafe] Exclusive mode in openFile

2011-06-28 Thread Brandon Allbery
On Tue, Jun 28, 2011 at 13:56, Gracjan Polak gracjanpo...@gmail.com wrote: What was the rationale behind such strict non-sharing policy? The obvious rationale is that it helps maintain the illusion of referential integrity within the process. (Outside is a lost cause, but operations on

Re: [Haskell-cafe] Exclusive mode in openFile

2011-06-28 Thread Max Bolingbroke
On 28 June 2011 18:56, Gracjan Polak gracjanpo...@gmail.com wrote: Anyway, where do I find an 'openFileShared' function? Packages unix/Win32 do not have obvious leads... Perhaps the functions in System.Posix.IO do what you want?