From ccb59ef80331826844fb170173b6df48ec10a100 Mon Sep 17 00:00:00 2001 From: Lennart Spitzner Date: Sat, 5 Aug 2017 16:09:46 +0200 Subject: [PATCH] Fix wherespecial with indent/=2 (fixes #39) --- .../Haskell/Brittany/Internal/Layouters/Decl.hs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Language/Haskell/Brittany/Internal/Layouters/Decl.hs b/src/Language/Haskell/Brittany/Internal/Layouters/Decl.hs index a4a9836..2cac911 100644 --- a/src/Language/Haskell/Brittany/Internal/Layouters/Decl.hs +++ b/src/Language/Haskell/Brittany/Internal/Layouters/Decl.hs @@ -215,12 +215,18 @@ layoutPatternBindFinal alignmentToken binderDoc mPatDoc clauseDocs mWhereDocs ha patPartParWrap = case mPatDoc of Nothing -> id Just patDoc -> docPar (return patDoc) - whereIndent <- - mAsk + whereIndent <- do + shouldSpecial <- mAsk <&> _conf_layout .> _lconfig_indentWhereSpecial .> confUnpack - .> Bool.bool BrIndentRegular (BrIndentSpecial 1) + regularIndentAmount <- mAsk + <&> _conf_layout + .> _lconfig_indentAmount + .> confUnpack + pure $ if shouldSpecial + then BrIndentSpecial (max 1 (regularIndentAmount `div` 2)) + else BrIndentRegular -- TODO: apart from this, there probably are more nodes below which could -- be shared between alternatives. wherePartMultiLine :: [ToBriDocM BriDocNumbered] <- case mWhereDocs of