behaviour change in getDirectoryContents in GHC 7.2?

John Millikin jmillikin at
Tue Nov 8 01:04:15 CET 2011

On Mon, Nov 7, 2011 at 15:39, Yitzchak Gale <gale at> wrote:
> The problem is that Haskell 98 specifies type FilePath = String.
> In retrospect, we now know that this is too simplistic.
> But that's what we have right now.

This is *a* problem, but not a particularly major one; the definition
of paths in GHC 7.0 (text on some systems, bytes on others) is
inelegant but workable.

The main problem, IMO, is that the semantics of openFile et al changed
in a way that is impossible to check for statically, and there was no
mention of this in the documentation. It's one thing to make a change
which will cause new compilation failures. It's quite another to
introduce an undocumented change in important semantics.

>> As implemented in GHC 7.2, this encoding is a complex and untested
>> behavior with no escape hatch.
> Isn't System.Posix.IO the escape hatch?
> Even though FilePath is still used there instead of
> ByteString as it should be, this is the
> low-level POSIX-specific library. So the old hack of
> interpreting the lowest 8 bits as bytes makes
> a lot more sense there.

System.Posix.IO, and the "unix" package in general, also perform the
new path encoding/decoding.

More information about the Glasgow-haskell-users mailing list