From 687b59c62f8a0239ad24194f137140f59b858696 Mon Sep 17 00:00:00 2001 From: Lennart Spitzner Date: Wed, 3 May 2023 20:25:19 +0000 Subject: [PATCH] Respect newlines before "where" --- .../Language/Haskell/Brittany/Internal/ToBriDoc/Decl.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/library/Language/Haskell/Brittany/Internal/ToBriDoc/Decl.hs b/source/library/Language/Haskell/Brittany/Internal/ToBriDoc/Decl.hs index 5683d18..5910999 100644 --- a/source/library/Language/Haskell/Brittany/Internal/ToBriDoc/Decl.hs +++ b/source/library/Language/Haskell/Brittany/Internal/ToBriDoc/Decl.hs @@ -238,7 +238,10 @@ layoutGrhs (L _ (GRHS epAnn guards body)) = do guardDocs <- case guards of [] -> pure [] _ -> docFlushCommsPost False posArrow $ callLayouter layout_stmt `mapM` guards - bodyDoc <- callLayouter layout_expr body + let bodyEndPos = case locA $ getLoc body of + GHC.RealSrcSpan s _ -> Just s + GHC.UnhelpfulSpan{} -> Nothing + bodyDoc <- docFlushCommsPost True bodyEndPos $ callLayouter layout_expr body return (Just epAnn, guardDocs, bodyDoc) layoutPatternBind