Aaron Denney wnoise at
Sun Dec 9 16:26:03 EST 2007

On 2007-12-09, Johannes Waldmann <waldmann at> wrote:
> 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
> ?

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

More information about the Libraries mailing list