[web-devel] FilePath in WAI

John Millikin jmillikin at gmail.com
Mon Jun 25 17:22:28 CEST 2012

On Mon, Jun 25, 2012 at 6:53 AM, Greg Weber <greg at gregweber.info> wrote:
>> system-filepath looks slightly odd to be because I would have expected the
>> representation internally to be platform-specific (e.g. either ByteString or
>> Text for Unix or Windows respectively), but it just uses String.
> I am kind of suprised to see an internal representation using strings
> also. I imagine that is because paths are usually used with
> system-fileio which needs strings for the existing Haskell APIs.
> system-fileio calls encodeString, which is OS specific, and that the
> internal code base is easier to maintain with 1 type. The
> encode/decode functions do return a platform specific type.

Having a single internal representation lets me avoid having to write
all the path manipulation primitives twice.

FilePaths use String so they can use the GHC 7.4 path encoding, which
supports round-tripping for Unix and Windows paths. It has used other
encodings (tried both Text and ByteString) in the past, but String+7.4
works well and is easier to use.

More information about the web-devel mailing list