Proposal #3456: Add FilePath -> String decoder

Ross Paterson ross at
Sun Sep 6 19:12:29 EDT 2009

On Sun, Aug 23, 2009 at 09:27:15AM -0700, Judah Jacobson wrote:
> 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.

Indeed, it would break an enormous amount of existing code.  A more
feasible migration path would be to introduce a new abstract type, say
NativeString, with corresponding variants of the file operations, getArgs
and getEnv, beside the Haskell 98 functions.  That could be done now.

Using Char to hold raw bytes (as GHC is doing, and this proposal would
implicitly condone) is a really bad idea.  It forces the programmer to
keep track of whether a particular String has been converted or not.
That's a job for the type system.

More information about the Libraries mailing list