Re: [Haskell] System.FilePath survey

* Have you used the existing FilePath module
No, but I rolled my own (years ago) http://dfa.imn.htwk-leipzig.de/auto/tool/haddock/Util-Datei.html
* Will you be happy with a library that represents the file path as String?
No. (If I see data represented by String, chances are that someone forgot to define an ADT. See Refactoring, Code smells, primitive obsession.)
The disadvantage is that with the current IO library we should convert from ADT to String and back again each time when we have to do any IO.
Irrelevant for performance, I think. If I want to do heavy IO, then I'd open a file (once) to get a handle, and use only the handle afterwards. Best regards, -- -- Johannes Waldmann -- Tel/Fax (0341) 3076 6479/80 -- ---- http://www.imn.htwk-leipzig.de/~waldmann/ -------

2006/2/3, Johannes Waldmann
The disadvantage is that with the current IO library we should convert from ADT to String and back again each time when we have to do any IO.
Irrelevant for performance, I think. If I want to do heavy IO, then I'd open a file (once) to get a handle, and use only the handle afterwards.
I mean that it is going to be boring. Cheers, Krasimir

Krasimir Angelov wrote:
Irrelevant for performance, I think. If I want to do heavy IO, then I'd open a file (once) to get a handle, and use only the handle afterwards.
I mean that it is going to be boring.
what? boring to write the conversions? I imagine the only two occasions where a file path has to be converted from String to ADT: when you read some fixed file (e. g. config file) ( that amounts to one line line conf :: File = mkFile ".conf" ) or when the user input a file name on command line or textfield. This would be only a few lines, no matter how large the program. (If you read user input from GUI, then you'd probably have some File selector widget that should of course return an ADT object.) Best regards, -- -- Johannes Waldmann -- Tel/Fax (0341) 3076 6479/80 -- ---- http://www.imn.htwk-leipzig.de/~waldmann/ -------

2006/2/3, Johannes Waldmann
what? boring to write the conversions? I imagine the only two occasions where a file path has to be converted from String to ADT: when you read some fixed file (e. g. config file) ( that amounts to one line line conf :: File = mkFile ".conf" ) or when the user input a file name on command line or textfield. This would be only a few lines, no matter how large the program. (If you read user input from GUI, then you'd probably have some File selector widget that should of course return an ADT object.)
It makes sense if the IO library was designed to accept ADT instead of String. I don't understand German but it seems like your library do that. It is more about file IO rather than file path manipulations. Cheers, Krasimir
participants (2)
-
Johannes Waldmann
-
Krasimir Angelov