From 5e3cc0a7c356e2ab55e17327fa3650e82017ca62 Mon Sep 17 00:00:00 2001 From: Lennart Spitzner Date: Sun, 4 Jun 2017 16:28:01 +0200 Subject: [PATCH] Fix OpApp layouting/indentation annoyance --- src-literatetests/tests.blt | 20 +++++++++++++++++++ .../Brittany/Internal/Layouters/Expr.hs | 3 +-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src-literatetests/tests.blt b/src-literatetests/tests.blt index 28525a1..3161a44 100644 --- a/src-literatetests/tests.blt +++ b/src-literatetests/tests.blt @@ -861,6 +861,26 @@ func = fooooooooooooooooooooooooooooooooo + foooooooooooooooooooooooooooooooo , foooooooooooooooooooooooooooooooo ] +#test opapp-indenting +parserPrim = + [ r + | r <- + [ SGPPrimFloat $ bool id (0-) minus $ readGnok "parserPrim" + (d1 ++ d2 ++ d3 ++ d4) + | d2 <- string "." + , d3 <- many1 (oneOf "0123456789") + , _ <- string "f" + ] + <|> [ SGPPrimFloat $ bool id (0-) minus $ fromIntegral + (readGnok "parserPrim" d1 :: Integer) + | _ <- string "f" + ] + <|> [ SGPPrimInt $ bool id (0-) minus $ fromIntegral + (readGnok "parserPrim" d1 :: Integer) + | _ <- string "i" + ] + ] + ############################################################################### ############################################################################### diff --git a/src/Language/Haskell/Brittany/Internal/Layouters/Expr.hs b/src/Language/Haskell/Brittany/Internal/Layouters/Expr.hs index f1ad0ad..4580c5b 100644 --- a/src/Language/Haskell/Brittany/Internal/Layouters/Expr.hs +++ b/src/Language/Haskell/Brittany/Internal/Layouters/Expr.hs @@ -213,8 +213,7 @@ layoutExpr lexpr@(L _ expr) = docWrapNode lexpr $ case expr of -- $ (appListDocs <&> \(od, ed) -> docCols ColOpPrefix [appSep od, docSetBaseY ed]) -- ++ [docCols ColOpPrefix [appSep opLastDoc, docSetBaseY expLastDoc]] -- ) - , docAddBaseY BrIndentRegular - $ docPar + , docPar leftOperandDoc ( docLines $ (appListDocs <&> \(od, ed) -> docCols ColOpPrefix [appSep od, docSetBaseY ed])