While many good Haskell programming habits come with experience, we have a few general guidelines to offer so that you can write readable code more quickly.
As we already mentioned in A Note About Tabs Versus Spaces, never use tab characters in Haskell source files. Use spaces.
If you find yourself proudly thinking that a particular piece of code is fiendishly clever, stop and consider whether you’ll be able to understand it again after you’ve stepped away from it for a month.
The conventional way of naming types and
variables with compound names is to use camel case, i.e.,
myVariableName. This style is almost universal in
Haskell code. Regardless of your opinion of other naming practices, if
you follow a nonstandard convention, your Haskell code will be somewhat
jarring to the eyes of other readers.
Until you’ve been working with Haskell for a substantial amount of time, spend a few minutes searching for library functions before you write small functions. This applies particularly to ubiquitous types such as lists, Maybe, and Either. If the standard libraries don’t already provide exactly what you need, you might be able to combine a few functions to obtain the result you desire.
Long pipelines of composed functions are
hard to read, where long means a series of more
than three or four elements. If you have such a pipeline, use a
where block to break it into smaller parts. Give each one of these pipeline elements a meaningful name, and then glue them ...