[GHC] #3456: Add FilePath -> String decoder
GHC
trac at galois.com
Sun Aug 23 12:16:38 EDT 2009
#3456: Add FilePath -> String decoder
-----------------------------+----------------------------------------------
Reporter: judahj | Owner:
Type: proposal | Status: new
Priority: normal | Component: libraries/base
Version: 6.10.4 | Severity: normal
Keywords: | Testcase:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
-----------------------------+----------------------------------------------
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)
}}}
This functionality is implemented in the attached patch; Haddock docs are
here:
http://code.haskell.org/~judah/new-io-docs/System-
IO.html#v%3AfilePathToString
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 platform.
Discussion deadline: September 9
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3456>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list