
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