This document outlines the style guidelines which should be followed when contributing to Matel.
WARNING. This document is a work in progress.
For all lines, the character-based length of a line should be less than or equal to seventy-two (72). Exceptions are made for lines which cannot be reasonably broken. Essentially, for all lines, a line can be reasonably broken iff this line can be re-written as multiple lines such that no single Haskell statement contains a line break.
An example of a line which cannot be reasonably broken is as follows:
deriveJSON defaultOptions {fieldLabelModifier = drop 4} ''DisplayNameResponse;
Matel's source code contains some unnecessary semicolons.
Let A denote the set of all things which can be terminated by semicolons without being broken.
For all k in A, k should be terminated by a semicolon.
An example of a poorly-placed semicolon is as follows:
main = blahblah;
where blahblah = and [so, so]
This semicolon is placed poorly because the "where
" clause which follows the semicolon is no longer specific to main
, which defeats the purpose of the "where
" clause.
For all functions eee, the line count of eee should be less than or equal to ten (10). This line count does not include the "where
" clauses which may be a part of eee; these things are considered to be separate functions. But note that functions which contain many "where
" clauses may be best broken into several separate functions.
However, there does exist a function such that this function is long but cannot be broken into multiple functions. Stet such functions.
Let A denote the set of all files which can reasonably be short.
For all f in A, the line count of f should be less than or equal to 400.