Good Haskell Style
Simon Marlow
simonmarhaskell at gmail.com
Wed Aug 1 10:50:26 EDT 2007
Ian Lynagh wrote:
> * 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'm with you all except for the 4th one:
> * Use the CamelCase variable naming convention
I'm rather attached to the convention I use, which is
- CamelCase for exported identifiers
- underscores otherwise
(I'm pretty sure I don't use it consistently, so don't bother to dig up
counter-examples though).
Why do I like this? Ideally we'd have an IDE which would colour my
exported identifiers differently, but since I don't use such an IDE the
CamelCase distinction gets some of the benefit. CamelCase for exported
identifiers is already an established convention (which should really be
part of a library API style guide), which leaves us with underscores for
local identifiers.
Yes I'm aware that a single-word identifier is the same in both
conventions; it's not perfect.
Cheers,
Simon
More information about the Libraries
mailing list