Good Haskell Style

Ashley Yakeley ashley at semantic.org
Thu Aug 2 21:52:01 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

"by giving a parse error if we break any of its rules" -- well, you 
hope, right?

My own preferences:

* Don't leave trailing white space in your code.
* Use one tab to indent each level. Display them at 4 space boundaries.
* Aim to keep lines under about 150 characters.
* Use the CamelCase variable naming convention.
* Use explicit braces and semicolons. Use "Allman" style.
* Put a newline at the end of the file.
* Prefix constructor names with "Mk" if there's only one in the type.
* Move private definitions to other "where" clauses where possible.
* Never use any unsafe functions (besides FFI). This is Haskell.
* Compile with "-Wall -Werror". This implies lots of type signatures.

For the time library source however I was rather closer to Ian's 
guidelines, just so as not to annoy people. I think it still has tabs 
though.

-- 
Ashley Yakeley



More information about the Libraries mailing list