
On 2007-12-09, Johannes Waldmann
Ian Lynagh wrote:
I'm having some problems using filepath in GHC. [...]
I'm sure this has been said before: using the type string to avoid an ADT is generally a bad idea. (it's the "primitive obsession" code smell.)
I hate the term "code smell". It's a quick inelegant phrase designed to shutdown discussion, rather than actually pointing out what's wrong with a design or a given section of code. For an OS interface, it makes sense to actually give something that corresponds directly to what that OS interface is. In this case there are actually several different interfaces. Unix uses byte sequences with 47 (i.e. '/') being treated specially, and a 0 terminator. Windows has several different interfaces.
There are well-established "file path" ADT designs, e.g. why don't we rather literally copy http://java.sun.com/javase/6/docs/api/java/io/File.html ?
Because they don't provide full compatibility for all platforms, and the path handling can end up being very surprising to experienced users of these platforms. -- Aaron Denney -><-