Clarify spacing in record syntax
authorKlaus Aehlig <aehlig@google.com>
Thu, 16 Jan 2014 15:36:14 +0000 (16:36 +0100)
committerJose A. Lopes <jabolopes@google.com>
Mon, 27 Jan 2014 09:38:18 +0000 (10:38 +0100)
So far, our code base does not have a consistent way of spacing
records. To work towards more consistency, add a recommendation
into out style guide. We standardize on what seems most common
in the Haskell world and also is the dominant form in our code
base.

Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

doc/dev-codestyle.rst

index b32fda1..79261d5 100644 (file)
@@ -351,6 +351,18 @@ following is also allowed::
     , value2
     ]
 
+For records, always add spaces around the braces and the equality sign.
+::
+
+  foo = Foo { fBar = "bar", fBaz = 4711 }
+
+  foo' = Foo { fBar = "bar 2"
+             , fBaz = 4712
+             }
+
+  node' = node { ip = "127.0.0.1" }
+
+
 White space
 ~~~~~~~~~~~
 Like in Python, surround binary operators with one space on either side. Do no