haskell package layout: a proposal

Mark Lentczner markl at glyphic.com
Sun Dec 5 20:59:50 CET 2010

I think I can summarize the feedback and concerns expressed on the reddit discussion, the blog's comments, and here on the mailing list:

0) "Nice proposal", "I heartily recommend it.", 28 up votes, 2 down (93%)


1) Executables should be on the user's path.
2) need to be sure to rebuild haddock index, and per tree

Both of these are about "making things just work". I agree. The binaries on the path *is* something we should preserve, and cabal already supports the symlink-bindir feature for just this reason. It allows one to put the binaries in one place, and symlink them into a bin directory on the $PATH. Such a scheme facilities easy removal in the future (kill the appropriate install tree, then remove broken symlinks in the $PATH bin dir -- otherwise you have know which binaries were in the package or packages you just deleted...)

Keeping the haddock index up-to-date is also very important, and again, cabal-install already does this, though I believe it only ever updates the --user index. For distributions, distributing a built index for the distributed --global docs is important. I suspect we all have little scripts for doing this. I'll try generalizing mine and making them available to packagers.

3) Package specific data and documentation shouldn't vary by compiler.
4) Why would anyone need executables of the same package built with different compilers at the same time?

I agree the first is strongly desirable, but not always true. The second arises when the executables are enhancements to the tool chain, and so are generally tool chain dependent. 

In either case, there is no harm to having these directories grouped per compiler, assuming points 1 & 2 above are addressed. Except perhaps for enabling bad practice.

5) By putting non-executable data in a separate place, it can be shared from a central server to machines with multiple architectures.
6) Compiler isn't specific enough: need os-processor-abi etc...
7) Cabal's dist structure is problematic in some cases.

These are concerns mostly for people building and installing in special environments. The vast majority of installs are on single user machines, with a single architecture. And .cabal/conf can still be customized to support any layout one can achieve now.  

8) Linux folks expect $prefix to be /usr/local 
9) An alternate suggestion essentially having a per $compiler subtree under each of lib/, libexec/, share/, and doc/

I surveyed some Linux distributions for how other language systems lay things out. They are more like the #9 suggestion, placing things in language & version specific subdirs in common directories for libs, modules, data, and doc. Though I found it interesting that often, even on the same platform and language, there were often two common places for the same thing in use. I'll note that not a single one of them used /usr/local, nor is it in the default search paths for either perl or python.

So, I think something like the #9 approach is probably best for linux like systems, and like my original proposal for Mac OS X (where each language's installs are segregated into /Library/${language}, and not spread around the system). I can't say much about the Windows layout.

  - Mark

More information about the Libraries mailing list