Good Haskell Style
John Meacham
john at repetae.net
Wed Aug 1 20:10:27 EDT 2007
On Wed, Aug 01, 2007 at 03:50:26PM +0100, Simon Marlow wrote:
> 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).
I almost do this, I use underscores for CAFs and very simple names
(often one word) for non-exported functions, but I try to keep them
local, in where or let clauses rather than at the top level.
non-exported top-level functions just are not all that common.
In any case, I was never a fan of style guidelines. well, not entirely
true, I am very much in favor of people publishing their guidelines to
give others inspiration and to learn from like Ian did. I was never in
favor of trying to get people to come to a consensus on one, many
man-hours that could have been spent writing delicious code has been
whittled away in pursuit of conformity for conformities sake.
Though, there certainly are technical (rather than aesthetic) reasons
for a lot of these things that some might consider style, such as the
whitespace ones above and indentation patterns that allow easy editing.
John
--
John Meacham - ⑆repetae.net⑆john⑈
More information about the Libraries
mailing list