Proposal #3456: Add FilePath -> String decoder

Judah Jacobson judah.jacobson at
Sun Aug 23 12:27:15 EDT 2009

Currently, FilePaths on POSIX systems are represented as raw bytes in
a String.  When this last came up on the mailing list, the general
consensus was to make FilePath an abstract datatype representing paths
as Strings on Windows and raw bytes on POSIX systems.  However, such a
change is sure to break some existing code.

As a small step towards that goal, I propose adding the following two
functions to the System.IO module:

filePathToString :: FilePath -> IO String
getFilePathToStringFunc :: IO (FilePath -> String)

I've implemented those functions in a patch attached to the trac
ticket.  Haddock docs are here:

On POSIX those functions decode according to the current locale, so
they ought to be in the IO monad.  I think that the latter function
will be easier to integrate into existing pure code.

On Windows, those functions are just `return` and `return id`,
respectively, since GHC already treats FilePaths as Strings on that

Discussion deadline: September 9


More information about the Libraries mailing list