[Haskell-cafe] RE: ANN: System.FilePath 0.9

Brian Smith brianlsmith at gmail.com
Mon Jul 17 17:10:01 EDT 2006

Hi Neil,

On 7/17/06, Neil Mitchell <ndmitchell at gmail.com> wrote:
> Hi Brian,
> You sent this email just to me, and not to the list. If you indended
> to send to the list then feel free to forward my bits on to the list.
> > I know that FilePath is defined by Haskell '98 as a String and so it
> cannot
> > be changed. So, perhaps a new type or class should be created for this
> > library (hereafter "GoodPath," although I am not suggesting that is the
> best
> > name).
> The problem is people will have to marshal their data into this
> GoodPath, and marshal it out again. When people can shortcut that
> marshalling, as the current readFile/writeFile definitions ensure they
> can, they will. At that point you loose all safety because people will
> abuse it.

I disagree. It would be trivial to create a new module that exported new
definitions of file IO actions that operated on "GoodPath" instead of
"FilePath," transparently delegating to the original readFile/writeFile/etc.
until they could be removed in the future. This would also support the
"SuperFilePath" idea you mentioned.

Another thing I thought of would be a "canonicalPath" IO action
(canonicalPath :: FilePath -> IO FilePath) that returns a FilePath that
implements case-preserving-case-insensitive matching. For example, if there
is a file named "Hello There.txt" in C:\, then
(canonicalPath "c:\hello there.txt ") would give "C:\Hello There.txt").

I think that the xxxDrive functions should only be exported from
System.FilePath.Windows and no System.FilePath since it is unclear as to how
they should be used effectively by cross-platform software.

- Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org//pipermail/haskell-cafe/attachments/20060717/faae9954/attachment-0001.htm

More information about the Haskell-Cafe mailing list