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

Andrew Pimlott andrew at pimlott.net
Wed Jul 26 16:21:13 EDT 2006

On Wed, Jul 26, 2006 at 08:19:47PM +0100, Neil Mitchell wrote:
> >Ok, this is a good use case.  What should wget do if "isValid" fails?
> makeValid is system dependant, and unspecified in its behaviour,
> although obviously some kind of closeness to the original would be
> ideal. So what if isValid fails and we don't have this?

Sorry, I meant to say what I think wget should do.  IMO, it should have
a conservative set of allowed characters, encode the filename into that
set using an escaping mechanism it specifies, attempt to open the file
O_EXCL, modify the name if it fails.  The allowed characters set could
perhaps come from the filepath module, though I suspect this is
overkill.  Simpler just to hard-code the set so that the name mangling
is platform-independent and can be fully documented.

> >> > As you acknowledge, it's a crap-shoot.  So what's the point?
> >> Its a case of reality, at the moment people use == to test if two file
> >> paths are equal, at least this is a better test.
> >Why is it better?
> Because its right more often, so pragmatically, is better

To me, that answer is unsatisfactory.

> >> >I think of that as a separate module, because extensions have no meaning
> >>> to the system and can be done with portable, functional code, as far as
> >> > I understand.
> >> Not really, what about getExtension "file.ext\lump" - the answer is ""
> >> on windows and ".ext\lump" on Posix.
> >You would only call the extension functions on a segment name.
> So this system independant extension module is dependant on a platform
> specific FilePath module? Or do you demand people make two function
> calls to get the extension?

One or the other, it seems a minor detail to me.  There's nothing wrong
with having the extension module use the filepath module.

> >> Not to the system, but some programs like to make a difference.
> >
> >How does it make a difference?  Do you have an answer that applies
> >uniformly to all programs?  If not, aren't we just walking down a blind
> >alley?  I've heard that Emacs treats double-separators specially.  Do we
> >account for that too?
> Haskell makes the difference, runInteractiveCommand vs runInteractiveProcess

I'm not following.


More information about the Haskell-Cafe mailing list