on master help sign in
Add a style guide
commit7dbe36c230f4b020a2436a45689d8b51497fb3d0 authorAdam Bergmark <adam@bergmark.nl> dateSat 30 Jul 2016, 16:49 (10 years ago) parentb00f84a
1 file changed+46
CONTRIBUTING.md+46
CONTRIBUTING.mdnew file+46
@@ -0,0 +1,46 @@
1+# Style guide
2+
3+* 4 space indentation
4+
5+## Pragmas
6+
7+* One pragma on each line
8+* No alignment
9+* Sort lexicographically
10+
11+```haskell
12+{-# LANGUAGE BangPatterns #-}
13+{-# LANGUAGE CPP #-}
14+{-# LANGUAGE DataKinds #-}
15+```
16+
17+## Module declaration and exports
18+
19+* Opening paren on its own line
20+* Prefix with commas
21+* End with `) where`
22+
23+```haskell
24+module Data.Aeson.Types.ToJSON
25+ (
26+ -- * Core JSON classes
27+ ToJSON(..)
28+ -- * Liftings to unary and binary type constructors
29+ , ToJSON1(..)
30+ , toJSON1
31+ ) where
32+```
33+
34+## Imports
35+
36+* No alignment of import lists or qualifications
37+* Sort lexicographically (qualified imports will be last)
38+* No space between types and constructor lists
39+* Sort identifiers in import lists lexicographically
40+
41+```haskell
42+import BarBar as B ((<>), foo)
43+import Foo as F
44+import Qux (Q(..), q)
45+import qualified A
46+```