
Hi, When it comes to adding System.FilePath, we seem to have reached a concensus of indecision, so I am going to attempt to set out the various options, and see if we can pick one. 1) Do not let programmers type "import System.FilePath", i.e. do not include the module No one seems to be advocating this. 2) Let programmers type "import System.FilePath" and have it work in Cabal Setup.hs files, and in all Cabal built programs without requiring the user specify that they are using the filepath package. This is what everyone wants. Within this there are two approaches being advocated: a) Add to base. b) Add as a library which we demand all Haskell compilers ship, and tweak Cabal to automatically use this library at all times. Option a involves absolutely no additional work for me - the patch has been posted to this mailing list. Option b involves Cabal hacking, establishing new procedures, coming up with a definition of libraries which are always available etc. It is likely that option b will be required once (if ever) base is split up. I certainly don't have time to do option b. So can I propose we add filepath, with this agreement that once (someone else) gets around to doing option b, we can split it out afterwards? The particular argument for upgrading the filepath library I think is not important - I never intend to do more filepath hacking. Someone might add one or two functions, but thats about the most I can invision. It's not a particularly pleasant job, its ugly - the only reason I started this was because the alternative is having everything broken on Windows - something I do care about. Thanks Neil

On Thursday 15 March 2007 17:25, Neil Mitchell wrote:
[...] So can I propose we add filepath, with this agreement that once (someone else) gets around to doing option b, we can split it out afterwards?
The particular argument for upgrading the filepath library I think is not important - I never intend to do more filepath hacking. Someone might add one or two functions, but thats about the most I can invision. It's not a particularly pleasant job, its ugly - the only reason I started this was because the alternative is having everything broken on Windows - something I do care about.
I would prefer b), too, mainly because I think that splitting up base in a sensible way most people can agree on is a Herculean task. Although this has almost been discussed to death, I still have one issue: File paths on *nix are *not* strings, they are simply a bunch of bytes, hopefully Haskell' will get this right. Adding a String-based module to base would give a conceptually wrong thing an "official touch". :-( Don't get me wrong: The operations in FilePath are OK, just the concrete representation is not correct. *sigh* What is the general strategy for Haskell' regarding this topic: Is I/O out of the scope of Haskell' itself? If not, what are the plans/the strategy for transitioning to something more correct? To be honest: I don't see an easy way out without breaking lots of existing programs. Cheers, S.

Hello Sven, Thursday, March 15, 2007, 8:10:18 PM, you wrote:
What is the general strategy for Haskell' regarding this topic: Is I/O out of the scope of Haskell' itself? If not, what are the plans/the strategy for transitioning to something more correct? To be honest: I don't see an easy way out without breaking lots of existing programs.
i see: just providing operations in libraries and allow one to import libraries he need. so, one can import FilePath 1.0 with String-based path representation or FilePath 2.0 with ByteString-based one -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

On Thursday 15 March 2007 18:57, Bulat Ziganshin wrote:
Thursday, March 15, 2007, 8:10:18 PM, you wrote:
What is the general strategy for Haskell' regarding this topic: Is I/O out of the scope of Haskell' itself? If not, what are the plans/the strategy for transitioning to something more correct? To be honest: I don't see an easy way out without breaking lots of existing programs.
i see: just providing operations in libraries and allow one to import libraries he need. so, one can import FilePath 1.0 with String-based path representation or FilePath 2.0 with ByteString-based one
Alas, this is no solution at all. The point is: Currently there is no explicit conversion FilePath <-> String, although this is really needed. Users e.g. enter FilePaths somehow through a GUI, on the command line, in a configuration file etc., so you often start with a String. But this has to be converted somehow to a bunch of bytes for accessing the file, and this can't be handled without an API change (where does the encoding come from?). The same holds for reading e.g. a directory which should be presented to the user, only the other way round: You get a bunch of bytes and have to decode these for presentation purposes. Specifying a "default" encoding is not really the right way to go, because this leads to sloppy programs which only work under special circumstances and suddenly break on other platforms with different defaults. Cheers, S. P.S.: The command line arguments are not really strings in *nix, either, so the current API is wrong, too.

Hi
Alas, this is no solution at all. The point is: Currently there is no explicit conversion FilePath <-> String, although this is really needed. Users e.g. enter FilePaths somehow through a GUI, on the command line, in a configuration file etc., so you often start with a String.
Surely both FilePath's and command line arguments are sufficiently string like that a reasonable interpretation of them is String? We don't want to provide an interface to Unix, we want to provide a proper abstraction over the underlying details. It would be a shame if on my Windows box I had to jump through artificial hoops because Posix is a bit broken... Thanks Neil

On Thursday 15 March 2007 19:18, Neil Mitchell wrote:
Surely both FilePath's and command line arguments are sufficiently string like that a reasonable interpretation of them is String? We don't want to provide an interface to Unix, we want to provide a proper abstraction over the underlying details.
It would be a shame if on my Windows box I had to jump through artificial hoops because Posix is a bit broken...
I'm lacking the time to list all those artificial hoops Windows has brought us, so I only urge everybody again: Let's not oversimplify things and handle things the Windows way. Although I would love to have a world where POSIX & friends used Unicode in tons of places, this is simply not the case. FilePath is meant to be an *abstraction*, hiding platform differences, and FilePath = String miserably fails to do this. Haskell got this wrong initially, but I'm hoping that Haskell' addresses this issue. As a compromise, we can leave the current FilePath as it is until things are settled, but I would really like to have a big, fat warning in the documentation then... Cheers, S.

Hi
As a compromise, we can leave the current FilePath as it is until things are settled, but I would really like to have a big, fat warning in the documentation then...
What would the warning say? "Haskell currently does not work when reading files or accessing command line arguments on Unix. Until such time as this is fixed please avoid opening files, or allowing the user to pass command line flags. The workaround is to either use Windows or Perl." :-) Do you have a concrete proposal for what FilePath's should look like in Haskell'? "FilePath = String" is currently the least broken design, since no one has put forward a better one. Thanks Neil

Hello Neil, Thursday, March 15, 2007, 9:43:48 PM, you wrote:
Do you have a concrete proposal for what FilePath's should look like in Haskell'? "FilePath = String" is currently the least broken design, since no one has put forward a better one.
does http://haskell.org/haskellwiki/Library/IO not count? -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

Hi Bulat,
Do you have a concrete proposal for what FilePath's should look like in Haskell'? "FilePath = String" is currently the least broken design, since no one has put forward a better one.
does http://haskell.org/haskellwiki/Library/IO not count?
It is a start, but not the whole answer. What is the type of readFile? Stringable a => a -> IO String ? What about getContents? Can all this be implemented without breaking existing code? Does this stop people from chopping and changing at strings? Is that desirable? There are also lots of other questions, does this code want to go into base? Do we want to replace the existing code in base? Is breaking nhc/yhc for something as fundamental as open files acceptable? Plenty of open questions, I suspect solving them all will take months at the very least... Thanks Neil

Hello Neil, Thursday, March 15, 2007, 10:54:03 PM, you wrote:
Do you have a concrete proposal for what FilePath's should look like in Haskell'? "FilePath = String" is currently the least broken design, since no one has put forward a better one.
does http://haskell.org/haskellwiki/Library/IO not count?
It is a start, but not the whole answer. What is the type of readFile? Stringable a =>> a -> IO String ?
yes, if we say only about Filepath part and not about type for representing file contents. another variant - provide some FilePath class. but providing your module as separate library will allow to improve this while keeping backward compatibility while including it into base makes this scenario very problematic
Stringable a =>> What about getContents? Can all this be implemented without breaking existing code? Does this stop people from chopping and changing at strings? Is that desirable?
the beauty of this proposal is that we can issue 3rd, 4th and any other version based on real users feedback. including some module into base means stopping of its active development, you can see the situation with ByteString
There are also lots of other questions, does this code want to go into base? Do we want to replace the existing code in base?
Plenty of open questions, I suspect solving them all will take months at the very least...
i think that existing base should be conserved for keeping compatibility with already developed apps/libs and new functionality should be provided in form of cabal packages that can be easily upgraded and even several versions can co-exist in one installation then, functionality should be moved step-by-step from base to these new packages. new functionality should go immediately into packages. otherwise, for example, your shining new version of Cabal which uses System.FilePath module, will be not compatible with ghc 6.6, and the same will be true for all other apps/libs then these packages will evolve. backward compatibility will be provided by supplying old versions of libraries (via hackage or preinstalled)
Is breaking nhc/yhc for something as fundamental as open files acceptable?
i don't understood this question -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

On Thu, 2007-03-15 at 23:25 +0300, Bulat Ziganshin wrote:
the beauty of this proposal is that we can issue 3rd, 4th and any other version based on real users feedback. including some module into base means stopping of its active development, you can see the situation with ByteString
You keep saying this but I really do not think it is true. There's nothing stopping people from adding new ByteString style functions. We export all the internals to make that possible. For example you'll notice that people have been looking at Unicode stuff, binary encoding, compression etc. There's been no lack of progress. We're not changing the main exported api because it already matches the Data.List api which was the original intention. That does not stop you from making extensions and exporting them from different modules. We're also planning to replace the current ByteString implementation with the version described in our paper that does the stream fusion rather than the older style functional array fusion. We can change this in base any time since it does not break any external APIs. We probably will not get around to doing that before 6.6.1 since we're working on other things at the moment but the point is that we could. You say that things added to base never change, have you considered that this might be because things get added to base when they are mature rather than because adding things to base imposes a code freeze? Of course if a module is still maturing and in a state of flux then adding it to base wouldn't be a good idea as one could not promise API stability. System.FilePath doesn't seem to be in that situation however, in my opinion it's ok to go into base (and come out again if/when base gets split up). Duncan

On Fri, Mar 16, 2007 at 09:44:26AM +1100, Duncan Coutts wrote:
Of course if a module is still maturing and in a state of flux then adding it to base wouldn't be a good idea as one could not promise API stability. System.FilePath doesn't seem to be in that situation however, in my opinion it's ok to go into base (and come out again if/when base gets split up).
I think that's roughly the argument you made for FPS, but looking at the repo history there are at least these API changes since the GHC 6.6 release: * export the right 'cycle' * Add a unit tests file, a test that append is lazy in the tail, and make it so. * "HEADS UP: Change CString api" * Make the lazy cons lazy, and add a cons' for when you want it to be strict * Make fromForeignPtr take the start so it is truly the inverse of toForeignPtr * Define headTail :: ByteString -> Maybe (Word8, ByteString) Sure, all of these can be worked around by importing internal modules and copying the corrected definitions (as I have had to do), but it would be much simpler if I could just depend on bytestring >= 1.1. Thanks Ian

Hi
I think that's roughly the argument you made for FPS, but looking at the repo history there are at least these API changes since the GHC 6.6 release:
Sure, all of these can be worked around by importing internal modules and copying the corrected definitions (as I have had to do), but it would be much simpler if I could just depend on bytestring >= 1.1.
There is a key difference here, ByteString is actively being worked on as a research area. I'm 100% happy with FilePath, I don't intend to go anywhere near it - I have plenty of research to do and none of it involves putting /slashes\ the right way round! Thanks Neil

Hello Neil, Friday, March 16, 2007, 6:22:05 AM, you wrote:
There is a key difference here, ByteString is actively being worked on as a research area. I'm 100% happy with FilePath, I don't intend to go anywhere near it - I have plenty of research to do and none of it involves putting /slashes\ the right way round!
yes, *you* are happy with it and therefore propose to add it to the base. *i* want to see it evolved sometime to support various bytestring kinds and therefore propose to keep it in separate library. otherwise, we will got either incompatibility between ghc versions or legacy system.filepath in base and new version in some 3rd-party library -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

Bulat Ziganshin
yes, *you* are happy with it and therefore propose to add it to the base. *i* want to see it evolved sometime to support various bytestring kinds and therefore propose to keep it in separate library. otherwise, we will got either incompatibility between ghc versions or legacy system.filepath in base and new version in some 3rd-party library
Unlike a lot of other languages (like Java) which grow incrementally, heaving the whole lot of old baggage in their library API, GHC base is allowed to evolve its interfaces (and yes, that breaks compatibility). I think it is a healthy approach, while the Java approach might bloat it to death (sadly, as i'm a Java user; at least the bytecode seem remains in good shape).

On Fri, 2007-03-16 at 02:55 +0000, Ian Lynagh wrote:
On Fri, Mar 16, 2007 at 09:44:26AM +1100, Duncan Coutts wrote:
Of course if a module is still maturing and in a state of flux then adding it to base wouldn't be a good idea as one could not promise API stability. System.FilePath doesn't seem to be in that situation however, in my opinion it's ok to go into base (and come out again if/when base gets split up).
I think that's roughly the argument you made for FPS, but looking at the repo history there are at least these API changes since the GHC 6.6 release:
* export the right 'cycle' * Add a unit tests file, a test that append is lazy in the tail, and make it so. * "HEADS UP: Change CString api" * Make the lazy cons lazy, and add a cons' for when you want it to be strict * Make fromForeignPtr take the start so it is truly the inverse of toForeignPtr * Define headTail :: ByteString -> Maybe (Word8, ByteString)
Sure, all of these can be worked around by importing internal modules and copying the corrected definitions (as I have had to do), but it would be much simpler if I could just depend on bytestring >= 1.1.
So some of these are just bug fixes and not api changes so will be in 6.6.1. But in general: so you could say that these bugs show we should have waited longer for the library to mature, on the other hand I rather suspect that we'd never have found these without the huge number of people using the lib that came from it being included as standard. That was not the only reason to include it of course. As I've mentioned before, a reason to keep it in base in future is that it gives us the opportunity to rewrite programs that don't even import ByteString into more efficient versions, for example: f . lines =<< readFile "foo" to f . map unpack . B.lines =<< B.readFile "foo" (and there may be further fusion opportunities if f is a fusible list consumer) Duncan

Hello Duncan, Friday, March 16, 2007, 12:07:24 PM, you wrote:
So some of these are just bug fixes and not api changes so will be in 6.6.1.
and some will be deferred until 6.8 when we will have one more incompatibility-break? thank you
But in general: so you could say that these bugs show we should have waited longer for the library to mature, on the other hand I rather suspect that we'd never have found these without the huge number of people using the lib that came from it being included as standard.
there are no differences in this aspect between base and any other bundled library
As I've mentioned before, a reason to keep it in base in future is that it gives us the opportunity to rewrite programs that don't even import ByteString into more efficient versions, for example:
f . lines =<< readFile "foo"
to
f . map unpack . B.lines =<< B.readFile "foo"
(and there may be further fusion opportunities if f is a fusible list consumer)
oh my god! you plan to further evolve base library and its legacy i/o part. but how about using unicode filenames or newer async i/o api? it should be also implemented inside base? one library for anything? :) i think that it will be much better if fps will be detached from base and you will provide i/o library on top of fps and lowIO [1] that makes all these cool things. this way you will got support of all the features lowIO provides for free [1] http://haskell.org/haskellwiki/Library/IO -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

On Fri, 2007-03-16 at 12:54 +0300, Bulat Ziganshin wrote:
So some of these are just bug fixes and not api changes so will be in 6.6.1.
and some will be deferred until 6.8 when we will have one more incompatibility-break? thank you
The changes are really pretty minor and only in the very low level part of the api.
But in general: so you could say that these bugs show we should have waited longer for the library to mature, on the other hand I rather suspect that we'd never have found these without the huge number of people using the lib that came from it being included as standard.
there are no differences in this aspect between base and any other bundled library
Bulat, I'm not arguing against making base a bit more modular, but you know how hard a task that is. Just yesterday we were struggling with issues of circular dependencies in the modules in base as we're experimenting with a new list library implementation. Heh, just to add to the confusion we've got our experimental list lib available as a separate package for people to play with, though obviously for it to be really practical in the long run it has to replace the list implementation, which (oh noes!) means sticking it in base. (Since otherwise you can't desugar things like list comprehensions into the new implementation.)
oh my god! you plan to further evolve base library and its legacy i/o part. but how about using unicode filenames or newer async i/o api? it should be also implemented inside base? one library for anything? :)
It's quite independent. It could work with any standard IO system. I mention the H98 readFile etc because that's what we have right now. Note that one could take advantage of async IO without changing the Handle API.
i think that it will be much better if fps will be detached from base and you will provide i/o library on top of fps and lowIO [1] that makes all these cool things. this way you will got support of all the features lowIO provides for free
As I said, it's quite independent. You could use ByteStrings with any sane IO library since all it needs is to be able to read/write data buffers. Duncan

Hello Duncan, Friday, March 16, 2007, 4:58:08 PM, you wrote:
So some of these are just bug fixes and not api changes so will be in 6.6.1.
and some will be deferred until 6.8 when we will have one more incompatibility-break? thank you
The changes are really pretty minor and only in the very low level part of the api.
but these parts are used too, yes? and libraries which depend on these features will be not compatible across ghc versions
But in general: so you could say that these bugs show we should have waited longer for the library to mature, on the other hand I rather suspect that we'd never have found these without the huge number of people using the lib that came from it being included as standard.
there are no differences in this aspect between base and any other bundled library
Bulat, I'm not arguing against making base a bit more modular, but you know how hard a task that is.
yes, and i tell about detaching part of base that still don;t have circular dependencies while you are planning to add such dependencies and make it undetachable. imho, FPS team work is very interesting in technical part, but not so good in social part. we can't work with newer implementations of your lib. we can't ask for new features to add (i mean that these features anyway will not be available for 6.6). you consider base as your own property and don't take into account other people requirements. if fps will be detached from base, i can develop my own libraries based on particular fps version and they will work with any ghc compiler. if your great idea about fast readFile implementation will be implemented via low-level IO lib as i proposed, this means that i can extend it to support unicode filenames and it will work with any ghc version, again
oh my god! you plan to further evolve base library and its legacy i/o part. but how about using unicode filenames or newer async i/o api? it should be also implemented inside base? one library for anything? :)
It's quite independent. It could work with any standard IO system. I mention the H98 readFile etc because that's what we have right now.
Note that one could take advantage of async IO without changing the Handle API.
and to implement this, one should change base, again. so the problem of monolithic base grows and grows. your better *technical* implementation of readFile as part of base raises number of *social* problems (i mean problems with unavailability of changes in base until ghc release, lack of support for alternative designs, incompatible changes of base between ghc versions) if, instead, you will implement new readFile as part of separate i/o package, it will be immediately available and support movement toward smaller building blocks
i think that it will be much better if fps will be detached from base and you will provide i/o library on top of fps and lowIO [1] that makes all these cool things. this way you will got support of all the features lowIO provides for free
As I said, it's quite independent. You could use ByteStrings with any sane IO library since all it needs is to be able to read/write data buffers.
but you can't use lowIO library inside base and this means that in order to support unicode filenames in base.readFile one need to implement their support inside of base. so, your force further growing of base instead of making many small separate packages -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

Duncan Coutts wrote:
But in general: so you could say that these bugs show we should have waited longer for the library to mature, on the other hand I rather suspect that we'd never have found these without the huge number of people using the lib that came from it being included as standard.
I certainly don't argue against bundling FPS (or any other package) with GHC (or any other compiler), and I don't think Bulat (or anybody else) is either. The problem is *packages*: we have a nice and flexible infrastructure for manipulating these, but with the exception of 'base'. When a library is in base, I can no longer depend on a particular version, upgrade to current development version, experiement with modifications, etc. With any other package, I can do so, and together with darcs and cabal, lots of code is very accessible, with a relatively smooth incline for getting gradually more involved. The 'base' package has a much wider gap between consumers and developers. To avoid confusion, could we use a separate term to describe required bundled libraries, "core libraries" perhaps? -k

On Fri, Mar 16, 2007 at 08:07:24PM +1100, Duncan Coutts wrote:
suspect that we'd never have found these without the huge number of people using the lib that came from it being included as standard.
Please, please, please, packages can come "as standard" (i.e. be a core package) without having all their modules be part of the base package.
As I've mentioned before, a reason to keep it in base in future is that it gives us the opportunity to rewrite programs that don't even import ByteString into more efficient versions, for example:
f . lines =<< readFile "foo"
to
f . map unpack . B.lines =<< B.readFile "foo"
(is B ByteString.Lazy here?) If we want to do that then we'd either need to put ByteString into base or split io out into its own package, yes (and incidentally, the latter I think would be fantastic; looking only at the cabal dependencies and (transitively, admittedly) extensions you would be able to see if a library was able to do IO). Thanks Ian

On Fri, 2007-03-16 at 14:03 +0000, Ian Lynagh wrote:
On Fri, Mar 16, 2007 at 08:07:24PM +1100, Duncan Coutts wrote:
suspect that we'd never have found these without the huge number of people using the lib that came from it being included as standard.
Please, please, please, packages can come "as standard" (i.e. be a core package) without having all their modules be part of the base package.
Yes.
As I've mentioned before, a reason to keep it in base in future is that it gives us the opportunity to rewrite programs that don't even import ByteString into more efficient versions, for example:
f . lines =<< readFile "foo"
to
f . map unpack . B.lines =<< B.readFile "foo"
(is B ByteString.Lazy here?)
Yes, that's the only way to preserve the semantics.
If we want to do that then we'd either need to put ByteString into base or split io out into its own package,
Aye, that'd probably work. I don't think the above transformation requires the list implementation be in the same package, since you could put rules into the bytestring/io lib that match on things defined in the list lib, eg: lines . B.unpack = map B.lines . B.lines
yes (and incidentally, the latter I think would be fantastic; looking only at the cabal dependencies and (transitively, admittedly) extensions you would be able to see if a library was able to do IO).
And if the dependencies (transitively) do not use the FFI which you can check by looking in the .cabal file and every module for OPTIONS pragmas. Not trivial but at least it could be automated. Duncan

Ian Lynagh wrote:
On Fri, Mar 16, 2007 at 08:07:24PM +1100, Duncan Coutts wrote:
suspect that we'd never have found these without the huge number of people using the lib that came from it being included as standard.
Please, please, please, packages can come "as standard" (i.e. be a core package) without having all their modules be part of the base package.
A useful example of package coming "as standard" with GHC 6.6 is Text.Regex. In GHC 6.4 all of Text.Regex and Text.Regex.Posix was part of the base package. I wrote a replacement set of packages: regex-base providing Text.Regex.Base* regex-posix providing Text.Regex.Posix* regex-compat provided Text.Regex The replacement Text.Regex was exactly the same API as the old Text.Regex, but used the new regex-posix package as the lower level. The new lower level Text.Regex.Posix was compatible with old Text.Regex.Posix -- Chris

Chris Kuklewicz wrote:
Ian Lynagh wrote:
suspect that we'd never have found these without the huge number of people using the lib that came from it being included as standard. Please, please, please, packages can come "as standard" (i.e. be a core
On Fri, Mar 16, 2007 at 08:07:24PM +1100, Duncan Coutts wrote: package) without having all their modules be part of the base package.
A useful example of package coming "as standard" with GHC 6.6 is Text.Regex.
In GHC 6.4 all of Text.Regex and Text.Regex.Posix was part of the base package.
I wrote a replacement set of packages: regex-base providing Text.Regex.Base* regex-posix providing Text.Regex.Posix* regex-compat provided Text.Regex
The replacement Text.Regex was exactly the same API as the old Text.Regex, but used the new regex-posix package as the lower level.
The new lower level Text.Regex.Posix was compatible with old Text.Regex.Posix
wrote too fast, I meant The new lower level Text.Regex.Posix was incompatible with old Text.Regex.Posix ^^^^^^^^^^^^

Duncan Coutts wrote:
On Thu, 2007-03-15 at 23:25 +0300, Bulat Ziganshin wrote:
the beauty of this proposal is that we can issue 3rd, 4th and any other version based on real users feedback. including some module into base means stopping of its active development, you can see the situation with ByteString
You keep saying this but I really do not think it is true.
One can hardly claim that active development stopped with ByteString's inclusion in base! On the other hand, I do think including it in base made contributing and participating more difficult. I used to track the development version, and my code could depend on specific versions, etc. Upgrading 'base' is much harder, and I've basically given up on that, and just wait for the next GHC snapshot, even if it means I have to implement 'groupBy' separately. Also, switching back and forth between being a separate package and a part of base complicates dependencies: code that used to depend on the 'fps' package suddenly breaks when the package is part of 'base', and to be compatible with both worlds, I need to juggle different cabal files. In the end, I just made a dummy fps package satisfying the dependency.
We probably will not get around to doing that before 6.6.1 since we're working on other things at the moment but the point is that we could.
You could change it, but it'd be hard for us mere users to pull it, test it out, and perhaps revert to the old version. As a separate package, it's just a few ghc-pkg's away. But regardless, if System.Filepath is well defined enough that it won't be updated, it doesn't matter where it goes. Presumably, it wouldn't have to be so hard: base could conceivably be more upgradeable, and cabal could grow backwards-compatibility functions for packages that are split or merged. (Are there other reasons for stuffing things in base than cyclic dependencies with other modules in it, btw?) -k

On Thursday 15 March 2007 19:43, Neil Mitchell wrote:
What would the warning say?
"Haskell currently does not work when reading files or accessing command line arguments on Unix. Until such time as this is fixed please avoid opening files, or allowing the user to pass command line flags. The workaround is to either use Windows or Perl." :-)
At least this would be a starting point... ;-)
Do you have a concrete proposal for what FilePath's should look like in Haskell'? "FilePath = String" is currently the least broken design, since no one has put forward a better one.
Of course I can't come up with an elaborate proposal in 5 minutes, but I think the main points should be: * FilePath is abstract, perhaps even constructed from FilePathElements (there are pros and cons for introducing the latter, I'm not totally sure about all implications). * Explicit operations for constructing and accessing a FilePath are provided. * Operations like the ones in your proposal are provided. Before one can make a concrete proposal, a proposal for a general encoding framework is needed and should be standardized, because we need a "fit" here. Another option would be handling things exactly the other way round: FilePath could be a synonym for ByteString, so things could look like the following (assuming functions from our imaginary encoding framework) : ... entries1 <- getDirectoryContents (encode utf8 "blah") mapM_ (putStrLn . decode utf8) entries1 entries2 <- getDirectoryContents myByteString ... But in general, I have a bad feeling about type synonyms for such cases... Cheers, S.

Hi
Of course I can't come up with an elaborate proposal in 5 minutes, but I think the main points should be:
* FilePath is abstract, perhaps even constructed from FilePathElements (there are pros and cons for introducing the latter, I'm not totally sure about all implications).
* Explicit operations for constructing and accessing a FilePath are provided.
* Operations like the ones in your proposal are provided.
In general, I don't see anything wrong with this proposal, but I'm perfectly happy with the status at the moment. I suspect that people who do things on FilePath's using the fact that they are String tend to get it wrong anyway, other than showing them. Of course, the reverse compatability situation in this case would be a complete nightmare - possibly bad enough to make it just plain impossible. The upside to adding my System.FilePath module as soon as possible would be that if people can be slowly weaned off hacking at FilePath's as String's, then your more drastic change is much more likely to be acceptable. In addition, if people move to entirely using System.FilePath then their code would already be portable to your scheme. Thanks Neil

On Thu, Mar 15, 2007 at 06:43:48PM +0000, Neil Mitchell wrote:
Do you have a concrete proposal for what FilePath's should look like in Haskell'? "FilePath = String" is currently the least broken design, since no one has put forward a better one.
I proposed something in http://www.haskell.org/pipermail/libraries/2005-July/004189.html although I never made code for it. I agree that we don't need to wait for this problem to be solved before doing something with your FilePath module, though. Thanks Ian

On 15-Mar-07, at 7:18 PM, Neil Mitchell wrote:
Alas, this is no solution at all. The point is: Currently there is no explicit conversion FilePath <-> String, although this is really needed. Users e.g. enter FilePaths somehow through a GUI, on the command line, in a configuration file etc., so you often start with a String.
Surely both FilePath's and command line arguments are sufficiently string like that a reasonable interpretation of them is String? We don't want to provide an interface to Unix, we want to provide a proper abstraction over the underlying details.
Indeed, paths and command-line arguments are becoming very string- like on Unix systems, too. On Mac OS X, the locale for file names is pretty much hardcoded to UTF-8. Mac OS X's native file system stores file names in UTF-16, but the POSIX layer sees it as UTF-8. For the last several years, all Linux distros I have used myself had all their filenames stored in UTF-8. And even before that, there was usually a single filename encoding used for the entire system. I have also heard that Java, Qt and GTK all can't handle file names that are invalid in the current system-wide encoding. For all intents and purposes, filenames that don't match my system encoding on my linux box are unusable. I only need to be able to access them from 'mv' and 'rm', and if 'fsck' automatically renamed them for me, I'd be even happier. If people want to write Haskell replacements for these basic tools, they can be expected to use platform-specific lower-level functions imported from System.Posix.
It would be a shame if on my Windows box I had to jump through artificial hoops because Posix is a bit broken...
Repeat the above statement with s/Windows/Mac OS X/ and again with s/ Windows/Single-User Desktop Linux/. Cheers, Wolfgang

On Friday 16 March 2007 00:15, Wolfgang Thaller wrote:
Indeed, paths and command-line arguments are becoming very string- like on Unix systems, too. On Mac OS X, the locale for file names is pretty much hardcoded to UTF-8. Mac OS X's native file system stores file names in UTF-16, but the POSIX layer sees it as UTF-8. [...]
I had a look how other languages and toolkits handle this issue. For those which do not completely ignore it, the consensus seems to be: * On Mac OS X, the POSIX layer indeed seems to use UTF-8, but in a *decomposed* form. This could be a little bit surprising, so some normalization is probably needed. * On Windows, the current ANSI code page is assumed, which could vary from installation to installation and can be changed by the user AFAIK. * For *nices the story is a bit tricky, but often a combination of * nl_laninfo(CODESET) * setlocale(LC_TYPE, 0) * the environment variables LC_ALL, LC_TYPE and LANG * iconv is used to figure out the current local encoding and use that. Depending on the distribution, it can be UTF-8 (e.g. recent SuSE distros), but it doesn't have to be. So I propose a compromise, we don't really have to be better than most languages/toolkits out there: Let's keep FilePath = String, but improve the real culprit, i.e. CString and friends. Currently, peekCString{,Len}, newCString{,Len} and withCString{,Len} simply use their "CA" ASCII counterparts. If we put the above common logic into Foreign.C.String, we could already achieve a lot. In addition, we might consider adding some e.g. ByteString-based API entries to the POSIX package for the real low-level stuff, but I think this is not a topmost priority. Opinions? Cheers, S.

Hello Sven, Friday, March 16, 2007, 4:24:47 PM, you wrote:
* On Windows, the current ANSI code page is assumed, which could vary from installation to installation and can be changed by the user AFAIK.
it was true for Win9x. NT-based systems supports new api which uses utf16 (of course they support old api too). generally, developers say that their programs supports unicode filenames if their programs supports this new api. its support implemented in Win32Files module from http://www.haskell.org/bz/FreeArc-sources.tar.gz -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

On Friday 16 March 2007 14:26, Bulat Ziganshin wrote:
Friday, March 16, 2007, 4:24:47 PM, you wrote:
* On Windows, the current ANSI code page is assumed, which could vary from installation to installation and can be changed by the user AFAIK.
it was true for Win9x. NT-based systems supports new api which uses utf16 (of course they support old api too). generally, developers say that their programs supports unicode filenames if their programs supports this new api. its support implemented in Win32Files module from http://www.haskell.org/bz/FreeArc-sources.tar.gz
Well, I know that there is a "wide" API now, I just wanted to point out what is commonly done when an 8bit <-> character conversion is needed. The problem is that Haskell's I/O libs current use e.g. _sopen instead of _wsopen, so I should probably rephrase my proposal then as follows: * Improve CStrings and friends to do some actual de-/encoding with the common default for the platform * Use a "wide" API when available internally Cheers, S.

Hello Sven, Friday, March 16, 2007, 4:42:00 PM, you wrote:
Well, I know that there is a "wide" API now, I just wanted to point out what is commonly done when an 8bit <-> character conversion is needed. The problem is that Haskell's I/O libs current use e.g. _sopen instead of _wsopen, so I should probably rephrase my proposal then as follows:
* Improve CStrings and friends to do some actual de-/encoding with the common default for the platform
* Use a "wide" API when available internally
my proposal is to implement second as part of new low i/o library because it's not only issue that we should fix. so, instead of patching here and there, new modular design should be started -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

On Friday 16 March 2007 14:56, Bulat Ziganshin wrote:
Friday, March 16, 2007, 4:42:00 PM, you wrote:
Well, I know that there is a "wide" API now, I just wanted to point out what is commonly done when an 8bit <-> character conversion is needed. The problem is that Haskell's I/O libs current use e.g. _sopen instead of _wsopen, so I should probably rephrase my proposal then as follows:
* Improve CStrings and friends to do some actual de-/encoding with the common default for the platform
* Use a "wide" API when available internally
my proposal is to implement second as part of new low i/o library because it's not only issue that we should fix. so, instead of patching here and there, new modular design should be started
I would strongly object against waiting so long, because agreeing on a new I/O API will probably take months, and I'm seriously not expecting any kind of consensus even within this year for something as fundamental. The nice parts about my proposal, as imperfect as it is from a purely theoretical viewpoint, are: * :We can do this *now*. * We can do this incrementally behind the scenes, no big bang is needed. * The Haskell APIs stay as they are at the moment, only the semantics are improved. Cheers, S.

Hello Sven, Friday, March 16, 2007, 5:08:00 PM, you wrote:
I would strongly object against waiting so long, because agreeing on a new I/O API will probably take months, and I'm seriously not expecting any kind of consensus even within this year for something as fundamental.
The nice parts about my proposal, as imperfect as it is from a purely theoretical viewpoint, are:
* :We can do this *now*.
* We can do this incrementally behind the scenes, no big bang is needed.
* The Haskell APIs stay as they are at the moment, only the semantics are improved.
it is just the source of our current problems with base. of course, it is easier to add something to base instead of refactoring it. so we have that we have - more and more features added here and it makes refcatoring more and more problematic. now FPS team wants to implement something in Base via bytestrings that will make them unremovable from base. i think that it is old way, new way to make software is small building blocks which are maintained independently there are two i/o libraries alternative to Handles - streams and ssc. now they are also monolithic but i tried to make analysis and proposed to split them into two parts - common low-level i/o which hides os details and high-level part that provides buffering and other features. SSC author supports this plan too if we have resources to improve i/o libs, i propose to invest them into support of these small building blocks instead of further inflation of base library, which anyway doesn't support all the modern i/o technologies -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

On Friday 16 March 2007 15:32, Bulat Ziganshin wrote:
it is just the source of our current problems with base. of course, it is easier to add something to base instead of refactoring it. so we have that we have - more and more features added here and it makes refcatoring more and more problematic. now FPS team wants to implement something in Base via bytestrings that will make them unremovable from base. i think that it is old way, new way to make software is small building blocks which are maintained independently [...]
I'm slowly getting tired of your arguments: If you think that your way is the right way, implement whatever you like and come back with what you've got afterwards for discussion, this is OpenSource SW, after all. Having highly modular libraries with perfect APIs everybody likes would be great, but this is not where we are and is not where we will be in the near future. Stopping all further improvements just because there is a Grand Shiny Master Plan in somebody's brain doesn't get us anywhere. I'm a big fan of the 80:20 rule, and my hope is that my tiny proposal might get us a long way until the upcoming API wars (there *will* be some, I can guarantee you, looking back at past discussions) are settled. Go ahead, split base, keep GHC/Hugs/nhc98 alive while doing it, implement your I/O on the tons of platforms we currently support, but be prepared for funny dependency cycles, built-in compiler knowledge, nasty platform/performance hacks, etc. The reason the libraries currently look as they are is not that the people writing them have been idiots or have never heard about the fundamentals of good SW design, the reason is that the libs slowly evolved from something rather simple and are maintained in a evolutionary manner with very few "big bangs". We do not have 100 paid people working full-time on this, after all... Cheers, S.

Hi
I'm slowly getting tired of your arguments: If you think that your way is the right way, implement whatever you like and come back with what you've got afterwards for discussion, this is OpenSource SW, after all
This is exactly what I've done with System.FilePath. I have been through several iterations making the entire concrete source code available at each point. I have changed everything until no one seems to object anymore to anything in the library - only to type FilePath = String, which isn't in my library. So can I suggest that the people objecting to inclusion in base: 1) Write the code that adds filepath as a core library, update build scripts for nhc/ghc/hugs, talk to everyone and gather agreement to include the filepath library always, add the appropriate magic to Cabal etc. [this is all good work which I think is essential in the long run, but I doubt anyone has time to do for a while] 2) Submit that patch that changes type FilePath = String, to whatever they may want, or to a class if that is what they would prefer. Update all appropriate API's this effects etc. Thanks Neil

Hello Neil, Friday, March 16, 2007, 6:32:55 PM, you wrote:
This is exactly what I've done with System.FilePath. I have been through several iterations making the entire concrete source code available at each point. I have changed everything until no one seems to object anymore to anything in the library - only to type FilePath = String, which isn't in my library.
i like the result (and i like FPS, too)! all that i want is to have ability to upgrade it in future -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

"Neil Mitchell"
So can I suggest that the people objecting to inclusion in base:
1) Write the code that adds filepath as a core library, update build scripts for nhc/ghc/hugs, talk to everyone and gather agreement to include the filepath library always,
OK, I have added the filepath package to the default builds of nhc98, and agree to distribute it in all future versions of the compiler. Regards, Malcolm

On Fri, Mar 16, 2007 at 04:24:21PM +0000, Malcolm Wallace wrote:
"Neil Mitchell"
wrote: So can I suggest that the people objecting to inclusion in base:
1) Write the code that adds filepath as a core library, update build scripts for nhc/ghc/hugs, talk to everyone and gather agreement to include the filepath library always,
OK, I have added the filepath package to the default builds of nhc98, and agree to distribute it in all future versions of the compiler.
I'm happy to do the work for adding it to GHC, but I'll need to talk to SimonM when he returns about the details first: It would make sense to either do the switch to building with cabal in 6.8 first (thus avoiding needing to add it the Makefile way), or to do it the Makefile way and also put it into 6.6.1 (which obviously has the advantage that it's available RSN by default with GHC; I don't think there's an interface issue here as it's a separate package, but I'd like to get Simon's input first!). If it's a sticking point then I'm sure I can work out how to get hugs to include it too, assuming Ross doesn't object. One thing: It would make things a lot simpler if filepath was moved to (or kept in sync with) http://darcs.haskell.org/packages/filepath/ (I know we could change darcs-all to take an optional repo URL, but it's messier when we want to fork the libraries into a ghc-6.8/ subdirectory). Thanks Ian

Hi
or to do it the Makefile way and also put it into 6.6.1 (which obviously has the advantage that it's available RSN by default with GHC; I don't think there's an interface issue here as it's a separate package, but I'd like to get Simon's input first!).
That would be handy.
If it's a sticking point then I'm sure I can work out how to get hugs to include it too, assuming Ross doesn't object.
It should make it into the Windows distribution of Hugs ;)
One thing: It would make things a lot simpler if filepath was moved to (or kept in sync with) http://darcs.haskell.org/packages/filepath/
Can be done easily enough, if we decide to go this route, I'll move it over and delete the original (I hate having out of sync libraries, and I hate thinking that libraries might be out of sync, even if they are automatically synced). The library as it stands is not suitable for including into GHC, the patch I made is however. The library should be structured differently, using cpp instead of os.info (as the patch does). Also the library has reverse compatibility gunk, i.e. System.FilePath.Version_0_10, which wants removing before it becomes stable. If this is the way you want to go, I'll redo the library and move it to darcs.haskell.org. Thanks Neil

On Wed, Mar 21, 2007 at 12:42:34AM +0000, Ian Lynagh wrote:
If it's a sticking point then I'm sure I can work out how to get hugs to include it too, assuming Ross doesn't object.
I can do that; it's no big deal.
One thing: It would make things a lot simpler if filepath was moved to (or kept in sync with) http://darcs.haskell.org/packages/filepath/
Yes indeed. I think it should be a requirement for core packages (those guaranteed to be shipped with all implementations) that their master development repositories are in http://darcs.haskell.org/packages.

Hi
Yes indeed. I think it should be a requirement for core packages (those guaranteed to be shipped with all implementations) that their master development repositories are in http://darcs.haskell.org/packages.
Agreed. I also suggest that any visible interface changes have to go though the libraries list in exactly the same as for base. Thanks Neil

On Wed, 2007-03-21 at 11:26 +0000, Neil Mitchell wrote:
Hi
Yes indeed. I think it should be a requirement for core packages (those guaranteed to be shipped with all implementations) that their master development repositories are in http://darcs.haskell.org/packages.
Agreed. I also suggest that any visible interface changes have to go though the libraries list in exactly the same as for base.
With the exception of Cabal presumably. Duncan

Hi Duncan,
With the exception of Cabal presumably.
Why? I recently tried to install lhs2tex, of course this doesn't work unless you share Cabal version with the author of the Setup.hs. Of course, if you've got that one, a whole new set of programs break. How far away is Cabal from presenting a stable interface? Is this not a goal in the long run? I realise Cabal is changing too fast at the moment, so perhaps apply this rule to Cabal at some future date. Thanks Neil

On Wed, 2007-03-21 at 11:38 +0000, Neil Mitchell wrote:
Hi Duncan,
With the exception of Cabal presumably.
How far away is Cabal from presenting a stable interface? Is this not a goal in the long run?
It is a goal.
I realise Cabal is changing too fast at the moment, so perhaps apply this rule to Cabal at some future date.
Right. Duncan

Ian Lynagh
One thing: It would make things a lot simpler if filepath was moved to (or kept in sync with) http://darcs.haskell.org/packages/filepath/ (I know we could change darcs-all to take an optional repo URL, but it's messier when we want to fork the libraries into a ghc-6.8/ subdirectory).
[ Tangential note: nhc98's version of darcs-all already permits optional repo URLs to appear in the default-packages database, if you want to cross-steal that code back again. ] Regards, Malcolm

On Wednesday 21 March 2007 18:32, Malcolm Wallace wrote:
[ Tangential note: nhc98's version of darcs-all already permits optional repo URLs to appear in the default-packages database, if you want to cross-steal that code back again. ]
Even more tangential note: When Hugs is in darcs, too, I'll merge all darcs-all scripts (for Hugs/GHC/nhc98), this will ease maintenance. Cheers, S.

Ian Lynagh wrote:
On Fri, Mar 16, 2007 at 04:24:21PM +0000, Malcolm Wallace wrote:
"Neil Mitchell"
wrote: So can I suggest that the people objecting to inclusion in base:
1) Write the code that adds filepath as a core library, update build scripts for nhc/ghc/hugs, talk to everyone and gather agreement to include the filepath library always, OK, I have added the filepath package to the default builds of nhc98, and agree to distribute it in all future versions of the compiler.
I'm happy to do the work for adding it to GHC, but I'll need to talk to SimonM when he returns about the details first: It would make sense to either do the switch to building with cabal in 6.8 first (thus avoiding needing to add it the Makefile way), or to do it the Makefile way and also put it into 6.6.1 (which obviously has the advantage that it's available RSN by default with GHC; I don't think there's an interface issue here as it's a separate package, but I'd like to get Simon's input first!).
This hasn't come up before, but I don't see any reason why we shouldn't add to the set of core-packages we ship in a minor patchlevel release. Cheers, Simon

Hi
I'm happy to do the work for adding it to GHC, but I'll need to talk to SimonM when he returns about the details first: It would make sense to either do the switch to building with cabal in 6.8 first (thus avoiding needing to add it the Makefile way), or to do it the Makefile way and also put it into 6.6.1 (which obviously has the advantage that it's available RSN by default with GHC; I don't think there's an interface issue here as it's a separate package, but I'd like to get Simon's input first!).
This hasn't come up before, but I don't see any reason why we shouldn't add to the set of core-packages we ship in a minor patchlevel release.
http://darcs.haskell.org/packages/filepath/ Once you've checked it meets whatever you need, I'll add a darcs tag. If anyone has any comments, please speak up quickly. I'm now NOT looking for remarks like "how about filepath's based on bytestrings?", but if anyone was to take a quick look over the structure, the use of CPP, anything else etc, I'd be grateful. Thanks Neil

Hello Sven, Friday, March 16, 2007, 6:24:22 PM, you wrote:
fundamentals of good SW design, the reason is that the libs slowly evolved from something rather simple and are maintained in a evolutionary manner with very few "big bangs". We do not have 100 paid people working full-time on this, after all...
i think that my proposal will allow better utilizing of our small developers base. or, saying in other words, developing a lot of small libs will increase a percentage of code reuse instead of copying or reinventing it the current i/o implementation in base is an example of this complexity. you need to become an expert just to understand what should be changed in order to add support of unicode filanmes, large files or anything else. the result is that these things remain unchanged for many years -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

Hello all,
On Fri, 16 Mar 2007 22:42:00 +0900, Sven Panne
it was true for Win9x. NT-based systems supports new api which uses utf16 (of course they support old api too).( snip )
Well, I know that there is a "wide" API now, I just wanted to point out what is commonly done when an 8bit <-> character conversion is needed. The problem is that Haskell's I/O libs current use e.g. _sopen instead of _wsopen, so I should probably rephrase my proposal then as follows:
* Use a "wide" API when available internally
I trid to change by just changing from ascii API to wide API tonight. But ... there is one problem. _wopendir defined in mingwex library, and mingwex requires dll. http://www.mingw.org/MinGWiki/index.php/mingwex C:\home>C:\home\ghc-6.7.20070314\ghc-6.7.20070314\bin\ghci.exe ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.7.20070314, for Haskell 98 . / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help. : C:/home/GHC-67~1.200/GHC-67~1.200/HSbase.o: unknown symbol `__wopendir' Loading package base ... linking ... : unable to load package `base' C:\home>C:\home\ghc-6.7.20070314\ghc-6.7.20070314\bin\ghci.exe ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.7.20070314, for Haskell 98 . / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help. Loading package base ... : can't load .so/.DLL for: mingwex (addDLL: unknown error) I can't find mingwex from anywhere. So I think we must change this part. Best Regards, -- shelarcy <shelarcy capella.freemail.ne.jp> http://page.freett.com/shelarcy/

On Sat, 17 Mar 2007 01:19:34 +0900, shelarcy
I trid to change by just changing from ascii API to wide API tonight. But ... there is one problem. _wopendir defined in mingwex library, and mingwex requires dll.
libmingwex.a requires dll and
I can't find mingwex from anywhere.
I can't find minwex.dll I'm sorry for typos. Thank you. -- shelarcy <shelarcy capella.freemail.ne.jp> http://page.freett.com/shelarcy/

Hello shelarcy, Friday, March 16, 2007, 7:19:34 PM, you wrote:
* Use a "wide" API when available internally
I trid to change by just changing from ascii API to wide API tonight. But ... there is one problem. _wopendir defined in mingwex library, and mingwex requires dll.
i've used _wfindfirsti64/_wfindnexti64 functions. of course, their semantics isn't the same as semantics of _wopendir. look at Win32Files module from http://www.haskell.org/bz/FreeArc-sources.tar.gz - it implements all the function i use to work with files in my program your patch is great, but it is incompatible with Unix and Win9x systems may be, you will be interested to work on low-level IO library as proposed in http://haskell.org/haskellwiki/Library/IO ? -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

Hello Bulat,
On Sat, 17 Mar 2007 03:28:06 +0900, Bulat Ziganshin
* Use a "wide" API when available internally
I trid to change by just changing from ascii API to wide API tonight. But ... there is one problem. _wopendir defined in mingwex library, and mingwex requires dll.
(snip)
your patch is great, but it is incompatible with Unix and Win9x systems
Yes, it's just partial modified files. I don't test to build on Unix yet. But if we want to support Win98, we can use opencow (or MSLU) like Win32 package HEAD. http://darcs.haskell.org/packages/Win32/configure.ac http://libunicows.sourceforge.net/ http://opencow.sourceforge.net/
may be, you will be interested to work on low-level IO library as proposed in http://haskell.org/haskellwiki/Library/IO ?
Yes, I'm interested in it. Best Regards, -- shelarcy <shelarcy capella.freemail.ne.jp> http://page.freett.com/shelarcy/

Hello shelarcy, Saturday, March 17, 2007, 6:01:20 AM, you wrote:
your patch is great, but it is incompatible with Unix and Win9x systems
Yes, it's just partial modified files. I don't test to build on Unix yet. But if we want to support Win98, we can use opencow (or MSLU) like Win32 package HEAD.
i've heard about this MSLU, but don't known that it is supported in Win32 package. so, we need to define only: open = #if WINDOWS wopen #else open #endif
may be, you will be interested to work on low-level IO library as proposed in http://haskell.org/haskellwiki/Library/IO ?
Yes, I'm interested in it.
in this case, i propose the following plan - write and test this library and only then write patch for the base. i think that debugging of independent library should be easier than working directly with base source modules for this library can be extracted from Streams (File, MappedFile) and base (System.Directory.*, System.Posix.Internals) if you are student, you can apply for SoC ticket dedicated to this work: http://hackage.haskell.org/trac/summer-of-code/ http://hackage.haskell.org/trac/summer-of-code/ticket/1113 http://hackage.haskell.org/trac/summer-of-code/wiki/StudApply -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

On Sat, 17 Mar 2007 03:28:06 +0900, Bulat Ziganshin
Friday, March 16, 2007, 7:19:34 PM, you wrote:
* Use a "wide" API when available internally
I trid to change by just changing from ascii API to wide API tonight. But ... there is one problem. _wopendir defined in mingwex library, and mingwex requires dll.
I'm sorry about I am wrong about this. If I use ghc to make binary, binary file can be linked with _wopendir. This problem is caused only on intepreter (GHCi and runghc). And this provlem isn't just _wopendir's, my current modified version reports error for _wreaddir's.
i've used _wfindfirsti64/_wfindnexti64 functions. of course, their semantics isn't the same as semantics of _wopendir. look at Win32Files module from http://www.haskell.org/bz/FreeArc-sources.tar.gz - it implements all the function i use to work with files in my program
So we need not use _wfindfirsti64/_wfindnexti64 functions. If someone knows that how to fix above problem, please tell me. I attached darcs version of current patch. (I removed modified version of package.conf.in from this patch. Because this doesn't help to fix above problem.) This patch doesn't support all unix platform. Vecause I don't modify configure.ac to detect that "wide" API available, and add alternative part for unavailable platform yet. -- shelarcy <shelarcy hotmail.co.jp> http://page.freett.com/shelarcy/

On Fri, Mar 16, 2007 at 02:24:47PM +0100, Sven Panne wrote:
So I propose a compromise, we don't really have to be better than most languages/toolkits out there: Let's keep FilePath = String, but improve the real culprit, i.e. CString and friends. Currently, peekCString{,Len}, newCString{,Len} and withCString{,Len} simply use their "CA" ASCII counterparts. If we put the above common logic into Foreign.C.String, we could already achieve a lot.
I'm not clear on exactly what you're proposing: would getDirectoryContents "." >>= mapM_ removeFile remove all the files in ".", regardless of what my locale is, my OS is, etc? i.e. would this solve my problem in http://www.haskell.org/pipermail/libraries/2005-July/004189.html ? Thanks Ian

On Friday 16 March 2007 15:10, Ian Lynagh wrote:
I'm not clear on exactly what you're proposing: would
getDirectoryContents "." >>= mapM_ removeFile
remove all the files in ".", regardless of what my locale is, my OS is, etc? i.e. would this solve my problem in
http://www.haskell.org/pipermail/libraries/2005-July/004189.html
OK, let's make this a bit more concrete and let's take Mac OS X as an example. On this platform, peekCString would decode from UTF-8 to Unicode (probably normalizing the Unicode string on the way), so no information is lost. OTOH, withCString would encode the Unicode string to UTF-8 (decomposing on the way? Wolfgang?). Both functions are used by getDirectoryContents internally, so this will be "Unicode-enabled" then, too. The main point here is that UTF-8 => Unicode => UTF-8 is lossless, and the same holds for my proposed change for *nices, too, as long as the local encoding is invertible in this sense. I am not sure if there are encodings in use out there which do not have this property, but even if they are: All e.g. Qt-based programs would share the same problems. For Windows platforms we should use the "wide" API internally, and the CString functions would be equivalent to their CWString counterparts. For older Windows versions we could fall back to "current ANSI code page", if we want to support those still. Of course this means that we e.g. can't use a single __hscore_open anymore (or we'll have to do some more cpp trickery to get the char vs. wchar_t problem right), but I think that the effort is manageable and can be done in a piecewise fashion. Cheers, S.

Hello Sven, Friday, March 16, 2007, 5:42:10 PM, you wrote:
On this platform, peekCString would decode from UTF-8 to Unicode (probably
For Windows platforms we should use the "wide" API internally, and the CString functions would be equivalent to their CWString counterparts.
of course, we can't change CString functions - they are used in many other places :) implementation just should use other functions. again, you may look on my Win32Files module. ideal Files module should at compile time select between unix/mac/win versions and on windows at runtime select between wide/legacy versions. also, i hope that it will support UTF8- and UTF16-encoded bytestrings as filenames because this allows to save time/space and absolutely required for programs that work with many thousands of files -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

On Friday 16 March 2007 16:03, Bulat Ziganshin wrote:
of course, we can't change CString functions - they are used in many other places :) [...]
Of course, we can. If somebody uses CString functions and expects them to behave like CAString functions, then their code is plainly wrong. Cheers, S.

On Fri, Mar 16, 2007 at 03:42:10PM +0100, Sven Panne wrote:
On Friday 16 March 2007 15:10, Ian Lynagh wrote:
I'm not clear on exactly what you're proposing: would
getDirectoryContents "." >>= mapM_ removeFile
remove all the files in ".", regardless of what my locale is, my OS is, etc? i.e. would this solve my problem in
http://www.haskell.org/pipermail/libraries/2005-July/004189.html
OK, let's make this a bit more concrete and let's take Mac OS X as an example.
I was really hoping for an answer along the lines of "yes" or "no" :-)
On this platform, peekCString would decode from UTF-8 to Unicode (probably normalizing the Unicode string on the way),
Why normalise it? A lot of the time we'll just be converting back to a filename later, so this sounds like wasted work.
so no information is lost.
Right, the normalising won't lose information as the filesystem requires fully denormalised(or whatever the right word is) filenames AIUI.
OTOH, withCString would encode the Unicode string to UTF-8 (decomposing on the way? Wolfgang?). Both functions are used by getDirectoryContents internally, so this will be "Unicode-enabled" then, too. The main point here is that UTF-8 => Unicode => UTF-8 is lossless,
OK, so I think my answer is "Yes" for MacOS X, which makes sense as both the filenames and strings are unicode.
and the same holds for my proposed change for *nices, too, as long as the local encoding is invertible in this sense. I am not sure if there are encodings in use out there which do not have this property, but even if they are: All e.g. Qt-based programs would share the same problems.
I got lost somewhere along the way here. Linux filenames are (to a first approximation) arbitrary sequences of word8s, unrelated to the "local encoding". So I think the answer to my question is no, getDirectoryContents "." >>= mapM_ removeFile might not remove everything in "." (if, say, my French friend created them and we are using Linux/ext2)? Thanks Ian

On Fri, 2007-03-16 at 15:42 +0100, Sven Panne wrote:
The main point here is that UTF-8 => Unicode => UTF-8 is lossless, and the same holds for my proposed change for *nices, too, as long as the local encoding is invertible in this sense. I am not sure if there are encodings in use out there which do not have this property, but even if they are: All e.g. Qt-based programs would share the same problems.
Gtk+/GNOME programs are fairly careful in this regard. When loading a file they keep *both* the original sequence of bytes that is the file name and they also interpret it in a particular locale and try to convert that to Unicode to display in the GUI. If that conversion fails it will do a best-effort conversion using replacement characters or just display "unknown file name" or somethin. However when saving the file again they always use the original file name which is just the raw sequence of bytes. When saving a new file and taking a Unicode string from the user they try to convert it to a locale encoding and if that conversion fails it asks the user to use a different name. See: http://developer.gnome.org/doc/API/2.0/glib/glib-Character-Set-Conversion.ht... the section near the top on "File Name Encodings" So a hypothetical FilePath ADT might keep both the raw and displayable unicode versions of a file name. Duncan

On Thu, Mar 15, 2007 at 06:10:18PM +0100, Sven Panne wrote:
What is the general strategy for Haskell' regarding this topic: Is I/O out of the scope of Haskell' itself?
When I last asked Isaac it (well, the fate of the standard libraries in general rather than IO in particular) hadn't been decided, and I haven't heard anything since. I recently opened a haskell-prime ticket for this issue: http://hackage.haskell.org/trac/haskell-prime/ticket/118 It would be good to resolve this ASAP as a number of other issues are blocked on it. Thanks Ian

Sven Panne wrote:
What is the general strategy for Haskell' regarding this topic: Is I/O out of the scope of Haskell' itself? If not, what are the plans/the strategy for transitioning to something more correct? To be honest: I don't see an easy way out without breaking lots of existing programs.
The main thing that Haskell' should do, IMO, is to get rid of everything IOish from the Prelude and drop the IO module. Then it becomes possible to disentangle the IO library from the base package (well, more possible at least), and we can think about experimenting with alternative IO APIs. Cheers, Simon

On 27/03/07, Simon Marlow
The main thing that Haskell' should do, IMO, is to get rid of everything IOish from the Prelude and drop the IO module. Then it becomes possible to disentangle the IO library from the base package (well, more possible at least), and we can think about experimenting with alternative IO APIs.
Personally, my hope for solving the libraries problem (libraries need to be updated more often than a compiler release rolls around), is cabal-install. IMO GHC should ship with a _very_ minimal set of libraries, perhaps none at all, then cabal-install should be used to install, and keep up-to-date, the associated libraries. Then changes like adding System.FilePath will take place within a week or two, not within a year or two. As I see it, this approach still has two major disadvantages: 1) It makes it impractical to code Haskell without a network connection, although this is become less of a problem all the time (who currently does code without one?) 2) Breaking backward-compatibility would have to be treated _very_ seriously, as otherwise we'd end up with literally hundreds of different versions of the libraries, none of which compatible with one another, and with applications written with only specific versions in mind. Still, food for though. Don't let's detract from the System.FilePath discussion, though. -- -David House, dmhouse@gmail.com

Hi there.
2) Let programmers type "import System.FilePath" and have it work in Cabal Setup.hs files, and in all Cabal built programs without requiring the user specify that they are using the filepath package.
This is what everyone wants. Within this there are two approaches being advocated:
a) Add to base.
b) Add as a library which we demand all Haskell compilers ship, and tweak Cabal to automatically use this library at all times.
Option a involves absolutely no additional work for me - the patch has been posted to this mailing list. Option b involves Cabal hacking, establishing new procedures, coming up with a definition of libraries which are always available etc. It is likely that option b will be required once (if ever) base is split up. I certainly don't have time to do option b.
So can I propose we add filepath, with this agreement that once (someone else) gets around to doing option b, we can split it out afterwards?
I think option 2a would be a huge improvement over the situation we have right now, so I'd be strongly in favor of adding FilePath to base for the time being. It's certainly not a perfect solution, I am aware of that, but none of the arguments given could convince me that it'll actually make things worse compared to now, so we should not prevent progress by trying to make everything perfect in a single step. Cheers, Andres

Hello Andres, Thursday, March 15, 2007, 10:31:56 PM, you wrote:
a) Add to base.
b) Add as a library which we demand all Haskell compilers ship, and tweak Cabal to automatically use this library at all times. I think option 2a would be a huge improvement over the situation we have right now, so I'd be strongly in favor of adding FilePath to base for the time being.
i think that it will be degradation because new base version will be not available for users before 6.8 arrives and then it will be hard to change this interface without breaking compatibility with existing code. otoh, providing it as separate library solves these problems. if developer is too lazy to cabalize his code, its not the cause to add his module to the base. let's wait for someone who will be more eager -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

Bulat Ziganshin
i think that it will be degradation because new base version will be not available for users before 6.8 arrives and then it will be hard to change this interface without breaking compatibility with existing code. otoh, providing it as separate library solves these problems. if developer is too lazy to cabalize his code, its not the cause to add his module to the base. let's wait for someone who will be more eager
With FPS i did use the library with GHC 6.4 by fetching and installing it via Cabal, and with GHC 6.6 it is shipped (thanks for that!). The same might be done to FilePath: those who need it before GHC 6.8 will fetch and install it manually (or via hackage), and those who use GHC 6.8 will have it out of the box. P.S. I think it should be possible to install the fresh version of FPS and GHC compiler should be smart enough to link both the old version (if it is required by some other part of the base) and the new one...
otoh, providing it as separate library solves these problems.
I don't think so. If you use a complex library which uses the old FilePath API, you usually stuck with the old FilePath API. For example, HAIFA (http://www.dcs.shef.ac.uk/~simonf/HAIFA.html) requires SYB3, which i couldn't find on the web, so, it being a separate package from the base didn't solve the problem.

Hello ArtemGr, Friday, March 16, 2007, 12:22:22 PM, you wrote:
I don't think so. If you use a complex library which uses the old FilePath API, you usually stuck with the old FilePath API. For example, HAIFA (http://www.dcs.shef.ac.uk/~simonf/HAIFA.html) requires SYB3, which i couldn't find on the web, so, it being a separate package from the base didn't solve the problem.
of course, to solve this problem, one should also upload his libraries to hackage :) this may be not possible for syb3 because it's closely coupled with ghc - i don't know -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

Bulat Ziganshin
For example, HAIFA (http://www.dcs.shef.ac.uk/~simonf/HAIFA.html) requires SYB3, which i couldn't find on the web, so, it being a separate package from the base didn't solve the problem.
of course, to solve this problem, one should also upload his libraries to hackage :) this may be not possible for syb3 because it's closely coupled with ghc - i don't know
As far as i understood, the SYB3 is considered no longer necessary with GHC6.6 extensions. Being unnecessary doesn't make the packages based on it work, though. Another example is hs-plugins (http://www.cse.unsw.edu.au/~dons/hs-plugins/). It still doesn't work with GHC6.6, as far as i know, and as such is simply unusable, despite all its greatness. The same goes to your compression library (http://www.haskell.org/haskellwiki/Library/Compression), which i couldn't build with recent GHC under CYGWIN. That is the point, i think, while FPS should be in the base, in a jurisdictional way. It might install as a separate package, but it should be maintained as the part of the base...

Hello ArtemGr, Friday, March 16, 2007, 1:14:24 PM, you wrote:
Another example is hs-plugins (http://www.cse.unsw.edu.au/~dons/hs-plugins/). It still doesn't work with GHC6.6, as far as i know, and as such is simply unusable, despite all its greatness.
The same goes to your compression library (http://www.haskell.org/haskellwiki/Library/Compression), which i couldn't build with recent GHC under CYGWIN.
are you tried to aks their authors? :) i never really supported Compression library because there are no user requests. really, i evolve it as a part of my app (http://www.haskell.org/bz/FreeArc-sources.tar.gz) and it definitely compiled on my box with 6.4 and 6.6. i use mingw, though -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

On Fri, Mar 16, 2007 at 10:14:24AM +0000, ArtemGr wrote:
That is the point, i think, while FPS should be in the base, in a jurisdictional way. It might install as a separate package, but it should be maintained as the part of the base...
Aha, it sounds like you are being confused by terminology. When making http://hackage.haskell.org/trac/ghc/wiki/PackageReorg we agreed on the term "core packages" (used interchangeably with "core libraries") for what you appear to mean by "the base". base is only one of the core packages, and fps^W^W^Wbytestring and filepath could be others without being "in base" (meaning "in the base package"). Thanks Ian

On Thu, Mar 15, 2007 at 04:25:55PM +0000, Neil Mitchell wrote:
Option b involves Cabal hacking,
No Cabal hacking is necessary. We might have to add "filepath" to a list in the cabal-setup source somewhere (I'm not sure if it already has a list or just uses --make at the moment), but that is hardly a large task. Thanks Ian
participants (15)
-
Andres Loeh
-
ArtemGr
-
Bulat Ziganshin
-
Chris Kuklewicz
-
David House
-
Duncan Coutts
-
Ian Lynagh
-
Ketil Malde
-
Malcolm Wallace
-
Neil Mitchell
-
Ross Paterson
-
shelarcy
-
Simon Marlow
-
Sven Panne
-
Wolfgang Thaller