@@ -1,296 +0,0 @@
1−We aim for a format of Haskell code that minimizes the amount of changes
2−necessary when modifying a line. For instance the indentation of any
3−given fragment of code should not depend on the length of identifiers.
13−Renaming the function requires changing all the lines to
22−A preferred alternative is to format like
32−We are grabbing some inspiration from
33−[Elm](https://elm-lang.org/docs/style-guide)
35−[Tweag's](https://github.com/tweag/guides/blob/master/style/Haskell.md)
38−The following examples show how a program is formatted in
39−multiple lines when the user introduces linebreaks. Otherwise,
40−the programs would be written in one line.
73− :: (C1, C2, C3, C4, C5)
80− -> AnotherLongDataTypeName
90− :: (C1, C2, C3, C4, C5)
93− -> ( LongDataTypeName
94− AnotherLongDataTypeName
95− AnotherLongDataTypeName2
96− AnotherLongDataTypeName3
98− -> AnotherLongDataTypeName4
110− if x then longFunctionName y else anotherLongFunctionName z
124− \(LongPattern2 y) ->
138−There is a do block. Note the change of indentation in the
153− longFunctionName x y
155− anotherLongFunctionName x z
158−`if` expression with monadic blocks
162− longFunctionName1 x y
163− longFunctionName2 x y
165− anotherLongFunctionName1 x z
166− anotherLongFunctionName2 x z
179− Just w -> functionName x y w
180− Nothing -> functionName x y z
183−Branches of `case` expression
187− longFunctionName x y w
189− anotherLongFunctionName x y z
196− (AnotherLongPattern y)
208−The right-hand side of guards
214− anotherLongFunctionName x
227− anotherLongFunctionName x
230−### Data type declarations
243−TODO: GADTs, record syntax, type families
248−{- When a comment is not preceded with elements on the same line,
249− they are indented as the elements in the enclosing AST node or
250− braces/parenthesis/brackets.
251− If it is between AST nodes, it is indented as the following
253− If the end-of-file follows, then indent to column 0.
256−f = g {- When there are preceding elements, keep single-line comments in the same line. -}
259−{- Multi-line comments can't be kept on the same line as @h = g@.
260− Otherwise, changing h or g would change the indentation of all
265− {- This comment always follows the R constructor -}
267− {- A comment not preceded by other elements -}
268− {- Another comment -}
279− -- indented the same as g
285−data R = R {- This comment always follows the R constructor -}
286− { f1 :: T1, {- An inner comment -} {- Another inner comment -} f2 :: T2, f3 :: T3}
291− {- This comment always follows the R constructor -}
292− { f1 :: T1 {- An inner comment -} {- Another inner comment -}