
Hi, In the GHC I/O system, a Handle may be backed by a "device" (IODevice instance) with IODeviceType = Directory There doesn't seem to be any (at least Google search did not give anything) code that uses this; however, what is supposed to be read from such a Handle: newline-separated list of filenames (like in getDirectoryContents), or some sort of serialized FileStatus structures, or anything else? Thanks. -- Dimitry Golubovsky Anywhere on the Web

On 14/09/2010 20:00, Dimitry Golubovsky wrote:
In the GHC I/O system, a Handle may be backed by a "device" (IODevice instance) with IODeviceType = Directory
There doesn't seem to be any (at least Google search did not give anything) code that uses this; however, what is supposed to be read from such a Handle: newline-separated list of filenames (like in getDirectoryContents), or some sort of serialized FileStatus structures, or anything else?
The FD implementation of Handles never makes a Handle with an IODeviceType of Directory, because openFile is specified to raise an exception when applied to a directory. So I suppose Directory could be considered superfluous in this context. It's there because we use IODeviceType elsewhere in the IO system, where it's important that Directory is a value (e.g. System.IO.FD.mkFD). Alternatively we could give it a meaning as you suggest - newline-separated file names seems like a reasonable interpretation. Cheers, Simon

Simon,
Thanks for your reply.
On 9/15/10, Simon Marlow
The FD implementation of Handles never makes a Handle with an IODeviceType of Directory, because openFile is specified to raise an exception when applied to a directory.
Yes, that was the only place in the Libraries' code I found that mentions this device type (which means I haven't missed anything ;)
Alternatively we could give it a meaning as you suggest - newline-separated file names seems like a reasonable interpretation.
It looks like there is no comments in the code for the definition of IODeviceType. I have created a ticket #4317 http://hackage.haskell.org/trac/ghc/ticket/4317 providing the code comments proposed. -- Dimitry Golubovsky Anywhere on the Web
participants (3)
-
Dimitry Golubovsky
-
Ian Lynagh
-
Simon Marlow