Good Haskell Style
Thomas Schilling
nominolo at googlemail.com
Wed Aug 1 17:33:40 EDT 2007
On 1 aug 2007, at 22.06, Iavor Diatchki wrote:
> Hi,
>
>> * 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
>
> I like using underscores in values, and CamelCase in types---I find
> that the extra space makes the identifiers more readable. Despite the
> fact that I tend to write code that follows these conventions (except
> for bullet 4), I find the rules to be extremely arbitrary and I do not
> think that they should be given any special status.
Style rules will *always* be arbitrary. The sole point is to have
*consistency*. You can always argue against decisions, there will
hardly be any waterproof arguments (or rather Coq-proofed or sth.),
but consistency is important and is absolutely appropriate for the
libraries.
This is not to say that this should be a the style for all Haskell
programs written anywhere, but it would be good to have a normative
style for the central libraries. Others then might adopt parts of
this guide for their projects, or not.
I am also pro enforced white space between binary operators (ie, "foo
++ bar" and "42 + 6 ^ (-5)" rather than "foo++bar" and "42+6^(-5)")
and defined module orderings (ie, local first, external later, or the
other way round.) In any case, stylistic standards are there to make
the boring things easy to recognize (and hence ignore) and let you
focus on the real meat.
/ Thomas
More information about the Libraries
mailing list