behaviour change in getDirectoryContents in GHC 7.2?

Simon Marlow marlowsd at
Wed Nov 9 17:04:12 CET 2011

On 08/11/2011 15:42, John Millikin wrote:
> On Tue, Nov 8, 2011 at 03:04, Simon Marlow<marlowsd at>  wrote:
>> I really think we should provide the native APIs.  The problem is that the
>> System.Posix.Directory API is all in terms of FilePath (=String), and if we
>> gave that a different meaning from the System.Directory FilePaths then
>> confusion would ensue.  So perhaps we need to add another API to
>> System.Posix with filesystem operations in terms of ByteString, and
>> similarly for Win32.
> +1
> I think most users would be OK with having System.Posix treat FilePath
> differently, as long as this is clearly documented, but if you feel a
> separate API is better then I have no objection. As long as there's
> some way to say "I know what I'm doing, here's the bytes" to the
> library.
> The Win32 package uses wide-character functions, so I'm not sure
> whether bytes would be appropriate there. My instinct says to stick
> with chars, via withCWString or equivalent. The package maintainer
> will have a better idea of what fits with the OS's idioms.

Ok, I spent most of today adding ByteString alternatives for all of the 
functions in System.Posix that use FilePath or environment strings.  The 
Haddocks for my augmented unix package are here:

In particular, the module System.Posix.ByteString is the whole 
System.Posix API but with ByteString FilePaths and environment strings:

It has one addition relative to System.Posix:

   getArgs :: IO [ByteString]

Let me know what you think.  I suspect the main controversial aspect is 
that I included

   type FilePath = ByteString

which is a bit cute but might be confusing.


More information about the Glasgow-haskell-users mailing list