Skip to content
Piyush P Kurur edited this page Aug 29, 2014 · 2 revisions

Coding style.

  1. Follow, as much as possible, the guidlines in Programming Guidelines on Haskell Wiki. As much as possible the code should compile and haddock with out warnings. Also use tools like hlint and stylish-haskell

  2. By default emacs uses the GNU style of indentation for C code. I (piyush-kurur) really cannot stand this style. Please use the linux kernel style. Here is the relevant portion of my .emacs

      ;; C coding style
      ;;
      (setq c-default-style "linux"
            c-basic-offset 4)
    

    For vim users set the following in the vimrc

      set tabstop=4 shiftwidth=4 expandtab
    
  3. Make sure that there are no trailing blanks at the end of lines and string of newlines at the end of the file. An easy way to ensure this is to enable the git hook called pre-commit. If you are in the root directory of the repository, the following command will do the trick. For more information see http://git-scm.com/book/en/Customizing-Git-Git-Hooks

      mv .git/hooks/pre-commit.sample .git/hooks/pre-commit
    
  4. Make sure that all lines end with \n instead of \r\n. In case you are using windows, please consider setting core.autocrlf true. The suggested settings for a windows user are

     git config core.autocrlf true
     git config core.safecrlf warn
    
Clone this wiki locally