Remove duplication in 'let' expression layout.

pull/66/head
Evan Rutledge Borden 2017-11-25 20:24:41 -05:00 committed by Lennart Spitzner
parent ba3d9ad739
commit 35f33c131c
1 changed files with 46 additions and 54 deletions

View File

@ -567,9 +567,7 @@ layoutExpr lexpr@(L _ expr) = do
(docSetBaseY $ expDoc1)
]
]
Just bindDocs@(_:_) -> docAlt $
case indentPolicy of
IndentPolicyLeft ->
Just bindDocs@(_:_) -> docAltFilter
--either
-- let
-- a = b
@ -583,7 +581,8 @@ layoutExpr lexpr@(L _ expr) = do
-- c = d
-- in
-- fooooooooooooooooooo
[ docLines
[ ( indentPolicy == IndentPolicyLeft
, docLines
[ docAddBaseY BrIndentRegular
$ docPar
(docLit $ Text.pack "let")
@ -593,19 +592,9 @@ layoutExpr lexpr@(L _ expr) = do
, docAddBaseY BrIndentRegular $ expDoc1
]
]
)
, ( indentPolicy /= IndentPolicyLeft
, docLines
[ docAddBaseY BrIndentRegular
$ docPar
(docLit $ Text.pack "let")
(docSetBaseAndIndent $ docLines $ return <$> bindDocs)
, docAddBaseY BrIndentRegular
$ docPar
(docLit $ Text.pack "in")
(docSetBaseY $ expDoc1)
]
]
_ ->
[ docLines
[ docSeq
[ appSep $ docLit $ Text.pack "let"
, docSetBaseAndIndent $ docLines $ return <$> bindDocs
@ -615,6 +604,8 @@ layoutExpr lexpr@(L _ expr) = do
, docSetBaseY $ expDoc1
]
]
)
, ( True
, docLines
[ docAddBaseY BrIndentRegular
$ docPar
@ -625,6 +616,7 @@ layoutExpr lexpr@(L _ expr) = do
(docLit $ Text.pack "in")
(docSetBaseY $ expDoc1)
]
)
]
_ -> docSeq [appSep $ docLit $ Text.pack "let in", expDoc1]
-- docSeq [appSep $ docLit "let in", expDoc1]