
Hi all, I've been sitting on this for four months for various reasons, but Neil and Duncan keep prodding me to send it, so here it is. The numbers in the mail are probably out of date by now, due to the start of the base splitup and general development, but I'm too lazy to update them. Thanks Ian ------------------ Hi all, My last attempt to write a contentious mail was a miserable failure, so I'm giving it another go. I've written up my description and rationale for what makes good Haskell style. The full thing is at http://urchin.earth.li/~ian/style/haskell.html but I'll copy the conclusion here: * Don't leave trailing white space in your code * Don't use tabs * Aim to keep lines under 80 characters * Use the CamelCase variable naming convention * Don't use explicit braces and semicolons There are also some tips on configuring vim to help out at http://urchin.earth.li/~ian/style/vim.html I think it would be great if we could agree on this (or perhaps some other) set of style guidelines for the core libraries, and encourage their use for other libraries. Future library submissions would be required to follow the guide, and the existing codebase could either be updated as other changes are made, or en masse just before the GHC 6.8 fork (to avoid unnecessary patch merging work). Just to help motivate the "Don't use tabs" point: I think someone was saying that they thought that base should use tabs, as that is what the existing code base uses. Here are some stats which show that that doesn't seem to be the case; it's hard to draw strong conclusions without actually manually looking at a large proportion of the library, but the indication is that 4 spaces is the dominant indentation. I've attached the script that made the stats. Total files: 162 Files where some lines start tab: 121 Files where some lines start 4 spaces: 133 Files where some lines start 8 spaces: 100 Percentage files where some lines start tab: 74% Percentage files where some lines start 4 spaces: 82% Percentage files where some lines start 8 spaces: 61% Non-blank lines: 47493 Lines that start white (white lines): 20584 Lines that start tab: 4239 Lines that start 4 spaces: 10691 Lines that start 8 spaces: 4509 Percentage non-blank lines start tab: 8% Percentage non-blank lines start 4 spaces: 22% Percentage non-blank lines start 8 spaces: 9% Percentage white lines start tab: 20% Percentage white lines start 4 spaces: 51% Percentage white lines start 8 spaces: 21% And a few more stats, just for interest really: Lines that have a tab after a space: 203 Lines that have a tab after a non-white character: 2401 Percentage non-blank lines have a tab after a space: 0% Percentage non-blank lines have a tab after a non-white character: 5% Thanks Ian, Neil and Duncan