RE: [Haskell-cafe] File path programme

On 24 January 2005 22:11, Ben Rudiak-Gould wrote:
Please, let's not ship this with the hierarchical libraries. It's not ready for prime time.
We decided to provide this library for purely pragmatic reasons. It's better than nothing. http://www.haskell.org/pipermail/libraries/2004-October/002605.html Doing a reasonable job on System.FilePath, even if it isn't perfect, will help prevent lots of applications from falling into common traps, and help make more code portable. Cheers, Simon

Simon Marlow wrote:
Doing a reasonable job on System.FilePath, even if it isn't perfect, will help prevent lots of applications from falling into common traps, and help make more code portable.
But the library code itself falls into the same traps! It's a great example of the kind of code we should be trying to replace! In many ways a library which violates its own interface specification is worse than no library at all. Inasmuch as the FilePath library doesn't violate its interface it's because the interface isn't well enough specified to prove a violation. The examples in the documentation are the obvious cases that Joe Programmer's hacked-up code is going to handle anyway. The non-obvious cases may break Joe's code; they definitely break the library. My concern here is that someone will actually use the library once it ships, with the following consequences: 1. Programs using the library will have predictable (exploitable) bugs in pathname handling. 2. It will never be possible to change the current weird behavior, because it might break legacy code. The System.FilePath library will have to remain in GHC forever in its current form, enticing programmers with its promise of easy pathname handling and then cruelly breaking its contract. If no one uses it in production code then we can fix it at our leisure, and having it out there with "experimental" status isn't necessarily a bad thing in that case. It just feels like we're playing a dangerous game. With respect to the old message you linked to: having an ADT for paths would not break any code, if what that means is that we provide parsePath :: String -> Maybe Path showPath :: Path -> Maybe String and various (new) functions operating on the Path type. I'd be much happier even if we just kept (roughly) the existing interface, but implemented it using a private ADT internally. Right now each function has its own integrated parser, with slight differences in e.g. drive letter handling, and there are probably more bugs I didn't notice. -- Ben

Ben Rudiak-Gould
Doing a reasonable job on System.FilePath, even if it isn't perfect, will help prevent lots of applications from falling into common traps, and help make more code portable.
But the library code itself falls into the same traps! It's a great example of the kind of code we should be trying to replace!
If problems are in the implementation but the interface is right, then the module should be provided. It can be fixed later. It's a bigger problem if the design is bad.
2. It will never be possible to change the current weird behavior, because it might break legacy code.
It will be possible if the old behavior is considered a bug. I doubt that programs will make use of these bugs.
With respect to the old message you linked to: having an ADT for paths would not break any code,
I don't see an advantage of using an ADT here.
Right now each function has its own integrated parser, with slight differences in e.g. drive letter handling, and there are probably more bugs I didn't notice.
Well, they should be easy to fix as long as we precisely determine the intended semantics. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/

On Tue, 25 Jan 2005, Marcin 'Qrczak' Kowalczyk wrote: (snip)
If problems are in the implementation but the interface is right, then the module should be provided. It can be fixed later. (snip)
A lot of the Haskell libraries are sufficiently poorly documented that I work out what they do by experiment, or by resorting to reading the source. There is a risk that code will be developed that relies on the observed broken behaviour, and is then broken when the implementation is fixed. -- Mark

Mark Carroll
On Tue, 25 Jan 2005, Marcin 'Qrczak' Kowalczyk wrote: (snip)
If problems are in the implementation but the interface is right, then the module should be provided. It can be fixed later. (snip)
A lot of the Haskell libraries are sufficiently poorly documented that I work out what they do by experiment, or by resorting to reading the source.
There should be a wiki page or some other list for libraries that need documentation to be added to them. I would be happy to add documentation here & there. Anyone want to volunteer to create the page and list some libraries there? peace, isaac

Hi,
I think Isaac's idea is pretty nice, to have an easy way to add documentation in a collaborative manner.
I have the following in mind:
A separate wiki which supports generating haddock documentation. Ideally one would see the haddock documentation as it is and would click to a function or type and change the comment for it. However, it would also be enough to see the complete source-code and change the comments there. The question is what happens if there is a parse error. Furthermore there must be someone who maintains it in the sense that changes are committed to cvs at some point and so on. Additionally, it seams to be complicated to keep it synchronised with "real" changes of the source code in the cvs.
Probably the most simple, but less "wiki" solution is the do it the traditional way. Just use cvs and a normal text editor and ask for a cvs account :-).
Cheers,
Georg
On Tue, 25 Jan 2005 12:36:54 -0800, Isaac Jones
Mark Carroll
writes: On Tue, 25 Jan 2005, Marcin 'Qrczak' Kowalczyk wrote: (snip)
If problems are in the implementation but the interface is right, then the module should be provided. It can be fixed later. (snip)
A lot of the Haskell libraries are sufficiently poorly documented that I work out what they do by experiment, or by resorting to reading the source.
There should be a wiki page or some other list for libraries that need documentation to be added to them. I would be happy to add documentation here & there.
Anyone want to volunteer to create the page and list some libraries there?
peace,
isaac _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- ---- Georg Martius, Tel: (+49 34297) 89434 ---- ------- http://www.flexman.homeip.net ---------

"Georg Martius"
Hi,
I think Isaac's idea is pretty nice, to have an easy way to add documentation in a collaborative manner. I have the following in mind:
Well, I've added a much less glorious page than yours on the wiki: http://www.haskell.org/hawiki/LibraryDocsNeedingHelp Click "edit text" and add as much information as possible about the shortcommings of the library documentation you run across. Extra points for patches posted to libraries@haskell.org. It would be nice if there were an easy way to link all the documentation together or allow people to add collaborative documentation hooks to CVS or something, but for now, a low-tech solution will have to do. peace, isaac

Isaac Jones writes:
This is a great idea. I have been thinking .... you know what would make contribution to the library efforts even simpler? If they were available in a Darcs repository. Saying "darcs push" after you've spontaneously added a three-line explanation into a standard library is a lot more attractive than "cvs diff", cutting and pasting that diff into an editor, and e-mailing it to the -libraries list. (Who submits a diff for three lines of documentation?) One of the reasons why Darcs is great is that it makes submitting changes very simple for _everybody_. Peter

Peter Simons
Isaac Jones writes:
This is a great idea.
I have been thinking .... you know what would make contribution to the library efforts even simpler? If they were available in a Darcs repository.
I can certainly understand Simon's wish to stay away from a split repository, one for GHC, one for libraries. What I'm doing for the cabal is keeping the _darcs directory in the same place as the CVS directory, and keeping them in sync by hand. This isn't too painful, if it were, I think there are some tools out there for this. Someone else suggested that someone maintain a darcs repository for the libraries and pull in documentatin changes, and then sync it all at once. I think that's a bad idea, because merging is never very easy, and is error prone. What might be good is if someone with CVS access would keep a darcs mirror of all of fptools (or just the libraries), and keep the darcs side automatically in sync w/ the CVS side (there are some tools for this). Then people could send darcs patches to this poor soul who would be sure to review them before committing them to CVS. I doubt that there would be too much traffic to handle, and if there were, then we could possibly put different people in charge of different components. Eventually, of course, everyone will realize that life would be simpler if we got rid of CVS altogether, and darcs will be mature enough to handle GHC, and we'll switch :)
Saying "darcs push" after you've spontaneously added a ^---- Probably "darcs send" if we're talking about letting the masses add documentation.
peace, isaac

On 2005-01-29, Isaac Jones
What I'm doing for the cabal is keeping the _darcs directory in the same place as the CVS directory, and keeping them in sync by hand. This isn't too painful, if it were, I think there are some tools out there for this.
I'd think that would be king of painful cvsync/tailor.py might work for this purpose, but I don' think it'd like having them be in the same location -- see http://www.scannedinavian.org/DarcsWiki/ConvertingFromSubversion Despite the URL it *ought* to work with CVS too. darcs get http://nautilus.homeip.net/~lele/projects/cvsync/
Someone else suggested that someone maintain a darcs repository for the libraries and pull in documentatin changes, and then sync it all at once. I think that's a bad idea, because merging is never very easy, and is error prone.
Agreed.
What might be good is if someone with CVS access would keep a darcs mirror of all of fptools (or just the libraries), and keep the darcs side automatically in sync w/ the CVS side (there are some tools for this). Then people could send darcs patches to this poor soul who would be sure to review them before committing them to CVS. I doubt that there would be too much traffic to handle, and if there were, then we could possibly put different people in charge of different components.
The script mentioned above will probably help with that.
Eventually, of course, everyone will realize that life would be simpler if we got rid of CVS altogether, and darcs will be mature enough to handle GHC, and we'll switch :)
Here's hoping. -- Aaron Denney -><-

Georg Martius wrote:
Hi,
I think Isaac's idea is pretty nice, to have an easy way to add documentation in a collaborative manner. I have the following in mind: A separate wiki which supports generating haddock documentation. Ideally one would see the haddock documentation as it is and would click to a function or type and change the comment for it. However, it would also be enough to see the complete source-code and change the comments there. The question is what happens if there is a parse error. Furthermore there must be someone who maintains it in the sense that changes are committed to cvs at some point and so on. Additionally, it seams to be complicated to keep it synchronised with "real" changes of the source code in the cvs. Probably the most simple, but less "wiki" solution is the do it the traditional way. Just use cvs and a normal text editor and ask for a cvs account :-).
Or, you could set the website to check out the code from CVS and use tex2html (assuming the comments are put in literate programming style) to generate the page. Keean.

Ben Rudiak-Gould writes:
1. Programs using the library will have predictable (exploitable) bugs in pathname handling.
2. It will never be possible to change the current weird behavior, because it might break legacy code.
I completely agree. Handling file path specifications as Strings is not a good idea. A path should be an abstract data type -- I think we all agree on that --; and if it were, it could be made an instance of Show, and all would be well. One argument against changing this has always been that it would break legacy code (as if it were a huge problem to add a 'show' call here and there). If GHC starts distributing even _more_ (broken) path manipulation functions which use String rather than something sensible, I fear that the window of opportunity for ever getting it right is shut. My suggestion would be to postpone distributing these modules until it is clear that they do work, or until someone has written something that does. The sources are readily available in CVS anyway, if you need them. Path handling is extremely tricky, especially if you want to be portable. IMHO, the subject deserves more attention before any of the existing solution should be labeled "reliable" -- and that is what shipping the code with GHC would implicitly do. Just my 0.02 Euros. Peter

On Tue, 2005-01-25 at 19:12 +0000, Ben Rudiak-Gould wrote:
My concern here is that someone will actually use the library once it ships, with the following consequences:
1. Programs using the library will have predictable (exploitable) bugs in pathname handling.
2. It will never be possible to change the current weird behavior, because it might break legacy code. The System.FilePath library will have to remain in GHC forever in its current form, enticing programmers with its promise of easy pathname handling and then cruelly breaking its contract.
If no one uses it in production code then we can fix it at our leisure, and having it out there with "experimental" status isn't necessarily a bad thing in that case. It just feels like we're playing a dangerous game.
That's a sufficiently persuasive argument for me! Could we just punt this library for this release. After all we can add libraries in a later point release (eg 6.4.1) you just can't change existing APIs. Hopefully if we leave it, the current discussion about designing some sane and portable file path functions will result in a reasonable replacement library. Duncan

Could we just punt this library for this release. After all we can add libraries in a later point release (eg 6.4.1) you just can't change existing APIs.
FWIW, I agree with Duncan, Ben, and Peter, that the new System.FilePath interface is broken, and the implementation more so. It would be better to redesign FilePaths as an algebraic datatype. Regards, Malcolm
participants (11)
-
Aaron Denney
-
Ben Rudiak-Gould
-
Duncan Coutts
-
Georg Martius
-
Isaac Jones
-
Keean Schupke
-
Malcolm Wallace
-
Marcin 'Qrczak' Kowalczyk
-
Mark Carroll
-
Peter Simons
-
Simon Marlow