Skip to content
rehno-lindeque edited this page Jun 3, 2012 · 1 revision

Code conventions

File names

Path names (files and directories) are always in singular form rather than plural to indicate that the file describes a topic not just a list of objects.

The exception to this rule is for plain data files that literally only hold a list of data elements. E.g. client/style/animations.css.

Imports

There's no black-and-white rule to imports, however the following guidelines are used in this project:

  • Standard library imports are either
    • Specific general purpose functions e.g. import Data.Text (Text, pack, append)
    • A qualified module of very specific functions e.g. import qualified Data.STM.TList as TList
      • But data types are sometimes imported directly e.g. import Data.STM.TList (TList)
  • Application modules
    • Imported unqualified when in the root directory e.g. import WebsocketApp
    • Imported qualified when in a subdirectory e.g. import qualified Observer.StorageObserver
      • But data types are sometimes imported directly e.g. import Observer.StorageObserver (FileObserver)
      • TODO: Possibly change this to one of
        • import qualified Observer.StorageObserver as StorageObserver
        • import qualified Observer.StorageObserver as Observer
Clone this wiki locally