Re: [Haskell] System.FilePath survey

Wolfgang Jeltsch
Am Freitag, 3. Februar 2006 12:03 schrieb Krasimir Angelov:
[...]
* Will you be happy with a library that represents the file path as String? The opposite is to use ADT for it. The disadvantage is that with the current IO library we should convert from ADT to String and back again each time when we have to do any IO. The ADT may have advantages for the internal library implementation.
I would very much prefer an ADT. An ADT would describe the actual logical structure of a file path and this is something we should always try to achieve.
Has anyone yet volunteered to do the hard work of defining an ADT and made a proposal for how it should interact w/ the System.IO functions? I think that lacking a FilePath module is a serious problem that is holding haskell back. Lots of languages use String for filepath, like Python, which is hugely popular for these uses, but has nothing on Haskell, IMO, except this single library. Lots of people have written home-grown FilePath modules. How long can we wait for an implementation to appear? peace, isaac

Isaac Jones wrote:
Has anyone yet volunteered to do the hard work of defining an ADT and made a proposal for how it should interact w/ the System.IO functions?
I think that lacking a FilePath module is a serious problem that is holding haskell back. Lots of languages use String for filepath, like Python, which is hugely popular for these uses, but has nothing on Haskell, IMO, except this single library.
Lots of people have written home-grown FilePath modules. How long can we wait for an implementation to appear?
The reason we can't just go right ahead and do The Right Thing (i.e. introduce a new ADT for FilePaths) is because it touches so much other stuff, including stuff that also needs revising, so it doesn't feel right to just fix the FilePath library. Experience with GHC releases has left me with the opinion that it's better to group breaking changes together rather than dribble them out - people only have to modify their code once, and conditional compilation gets fewer cases. So I'm of the opinion that introducing an ADT for FilePaths is something that should wait until the I/O library is revised. In the meantime, we should include a String-based Data.FilePath library in Haskell'. It's not as elegant, but it's terribly practical, and that's one goal of Haskell'. As a first step, can someone package up Data.FilePath as a Cabal package so that at least we can all start using the same one? Cheers, Simon

On 2/6/06, Simon Marlow
Isaac Jones wrote:
Has anyone yet volunteered to do the hard work of defining an ADT and made a proposal for how it should interact w/ the System.IO functions?
I think that lacking a FilePath module is a serious problem that is holding haskell back. Lots of languages use String for filepath, like Python, which is hugely popular for these uses, but has nothing on Haskell, IMO, except this single library.
Lots of people have written home-grown FilePath modules. How long can we wait for an implementation to appear?
The reason we can't just go right ahead and do The Right Thing (i.e. introduce a new ADT for FilePaths) is because it touches so much other stuff, including stuff that also needs revising, so it doesn't feel right to just fix the FilePath library.
Experience with GHC releases has left me with the opinion that it's better to group breaking changes together rather than dribble them out - people only have to modify their code once, and conditional compilation gets fewer cases.
So I'm of the opinion that introducing an ADT for FilePaths is something that should wait until the I/O library is revised. In the meantime, we should include a String-based Data.FilePath library in Haskell'. It's not as elegant, but it's terribly practical, and that's one goal of Haskell'.
As a first step, can someone package up Data.FilePath as a Cabal package so that at least we can all start using the same one?
Already done. Darcs repository: http://scannedinavian.com/~lemmih/FilePath/ Tarball: http://hackage.haskell.org/packages/FilePath-0.1.0.tgz -- Friendly, Lemmih

On Mon, Feb 06, 2006 at 03:36:17PM +0000, Simon Marlow wrote:
The reason we can't just go right ahead and do The Right Thing (i.e. introduce a new ADT for FilePaths) is because it touches so much other stuff, including stuff that also needs revising, so it doesn't feel right to just fix the FilePath library.
Experience with GHC releases has left me with the opinion that it's better to group breaking changes together rather than dribble them out - people only have to modify their code once, and conditional compilation gets fewer cases.
So I'm of the opinion that introducing an ADT for FilePaths is something that should wait until the I/O library is revised. In the meantime, we should include a String-based Data.FilePath library in Haskell'. It's not as elegant, but it's terribly practical, and that's one goal of Haskell'.
I don't see why merely introducing an ADT would break anyone's code, as there is no existing standard filepath model, therefore no code to break! The code I posted works with the current IO library and uses an ADT. I also think it has the potential to be compatible with a redesigned IO library. I further believe in incremental change when possible. So if it's possible to try out a "better" approach to filepaths (whatever "better" may be) without redesigning IO, IMO that's exactly what we should do. Now it may be that the need for a filepath library is so great, and "better" approaches sufficiently untested, that we should use whatever exists and works right now. But that is a separate question. Andrew

Andrew Pimlott wrote:
On Mon, Feb 06, 2006 at 03:36:17PM +0000, Simon Marlow wrote:
The reason we can't just go right ahead and do The Right Thing (i.e. introduce a new ADT for FilePaths) is because it touches so much other stuff, including stuff that also needs revising, so it doesn't feel right to just fix the FilePath library.
Experience with GHC releases has left me with the opinion that it's better to group breaking changes together rather than dribble them out - people only have to modify their code once, and conditional compilation gets fewer cases.
So I'm of the opinion that introducing an ADT for FilePaths is something that should wait until the I/O library is revised. In the meantime, we should include a String-based Data.FilePath library in Haskell'. It's not as elegant, but it's terribly practical, and that's one goal of Haskell'.
I don't see why merely introducing an ADT would break anyone's code, as there is no existing standard filepath model, therefore no code to break!
Sure there's an existing filepath model - the IO module contains this: type FilePath = String and all filesystem operations work in terms of FilePath. Changing the representation of FilePath would break code.
The code I posted works with the current IO library and uses an ADT. I also think it has the potential to be compatible with a redesigned IO library.
Yes, but you didn't change FilePath, you added some new file path types and operations, so anyone using your library has to convert from one to the other in order to call exisitng IO operations. Certainly that's an acceptable solution, but not my prefferred solution because we end up with two kinds of path types, albeit temporarily. This will seem confusing and unnecessary to newcomers. However, it does have the advantage of being "upwards compatible" as you point out, so it's a difficult judgement call. (I admit I haven't groked your code fully yet, BTW) Cheers, Simon

On Wed, Feb 08, 2006 at 09:39:38AM +0000, Simon Marlow wrote:
Andrew Pimlott wrote:
I don't see why merely introducing an ADT would break anyone's code, as there is no existing standard filepath model, therefore no code to break!
Sure there's an existing filepath model - the IO module contains this:
type FilePath = String
Sorry, I mistyped. I meant "filepath module", ie the path manipulation functions.
Yes, but you didn't change FilePath, you added some new file path types and operations, so anyone using your library has to convert from one to the other in order to call exisitng IO operations.
Right, that's an inconvenience. As I wrote it, though, it's only a matter of calling "show". Andrew

On Mon, Feb 06, 2006 at 03:36:17PM +0000, Simon Marlow wrote:
So I'm of the opinion that introducing an ADT for FilePaths is something that should wait until the I/O library is revised. In the meantime, we should include a String-based Data.FilePath library in Haskell'. It's not as elegant, but it's terribly practical, and that's one goal of Haskell'.
As a first step, can someone package up Data.FilePath as a Cabal package so that at least we can all start using the same one?
how about we take the library as is for now and then add newtype FilePath = FilePath String filePathToString (FilePath s) = s stringToFilePath s = FilePath s that way, when FilePath is replaced by something more interesting, no code dealing with it needs to change as it is already written to an ADT (though a simple one for now) and we could experiment with more advanced representations without breaking anyones code. John -- John Meacham - ⑆repetae.net⑆john⑈
participants (5)
-
Andrew Pimlott
-
Isaac Jones
-
John Meacham
-
Lemmih
-
Simon Marlow