Description
Style Guide for Haskell
There are some style considerations to make in regret to writing Haskell code.
Paradigm Preference
Normally Haskell programmers prefer to write declarative code instead of imperative code, but as imperative code is used on the mainstream and most non-haskell coders are more familiar with it, it could be viewed as an alternative.
Code Readability
As said in the "how_to_contribute.md" file we should use the style preferences of the language we are writing, but we should also consider readability as a must, because our code is going to be public and accessible on the internet.
I would recommend writing code as readable as possible even if you would rewrite it in a not so familiar style of coding.
An example:
euclidSub :: Integer -> Integer -> Integer
euclidSub a b = inner (abs a) (abs b) where
inner a b =
if a == b then
a
else if a < b then
euclidSub a (b - a)
else
euclidSub (a - b) b
Could Be wiritten as:
euclidSub :: Integer -> Integer -> Integer
euclidSub a b = inner (abs a) (abs b)
where
inner a b
| a == b = a
| a < b = euclidSub a (b - a)
| otherwise = euclidSub (a - b) b
(Example currently in use in the Euclidean Algorithm)