diff --git a/src/HIndent/Styles/Gibiansky.hs b/src/HIndent/Styles/Gibiansky.hs index f9b5261e5..8ca8d9f3c 100644 --- a/src/HIndent/Styles/Gibiansky.hs +++ b/src/HIndent/Styles/Gibiansky.hs @@ -412,8 +412,18 @@ caseExpr _ = error "Not a case" rhss :: Extend Rhs rhss _ (UnGuardedRhs _ exp) = do - write " = " - pretty exp + write " =" + if onNextLine exp + then indented indentSpaces $ do + newline + pretty exp + else do + space + pretty exp + + where + onNextLine Let{} = True + onNextLine _ = False rhss _ rhs = prettyNoExt rhs guardedRhs :: Extend GuardedRhs diff --git a/test/gibiansky/expected/3.exp b/test/gibiansky/expected/3.exp index 8e427bca4..ac1825270 100644 --- a/test/gibiansky/expected/3.exp +++ b/test/gibiansky/expected/3.exp @@ -6,13 +6,15 @@ let x = y z = w in x -a = let x = y - z = w - in x +a = + let x = y + z = w + in x -a = let x = y - z = w - in x +a = + let x = y + z = w + in x let x = y z = w @@ -21,8 +23,23 @@ in x let z = w in x -a = let z = w - in x +a = + let z = w + in x -a = let z = w - in x +a = + let z = w + in x + +f x = + let g x = 5 + g x = 5 + in 3 + +f = + let y = z + in z + +f x = + let y = z + in z diff --git a/test/gibiansky/tests/3.test b/test/gibiansky/tests/3.test index 6424ebcd0..ab3fb7bf6 100644 --- a/test/gibiansky/tests/3.test +++ b/test/gibiansky/tests/3.test @@ -27,3 +27,12 @@ a = let a = let z = w in x + +f x = + let g x = 5 + g x = 5 + in 3 + +f = let y = z in z + +f x = let y = z in z