1
1
mirror of https://github.com/google/ormolu.git synced 2024-12-11 08:44:45 +03:00

Support single line where clauses

This commit is contained in:
Basile Henry 2019-07-13 18:13:18 +01:00 committed by Mark Karpov
parent 0baa898f30
commit b2f49a7693
2 changed files with 6 additions and 6 deletions

View File

@ -1,7 +1,5 @@
foo :: Int -> Int foo :: Int -> Int
foo x = f x foo x = f x where f z = z
where
f z = z
bar :: Int -> Int bar :: Int -> Int
bar x = f x bar x = f x

View File

@ -200,11 +200,13 @@ p_match' placer pretty style isInfix strictness m_pats m_grhss = do
then RightArrow then RightArrow
else EqualSign else EqualSign
newlineSep (located' (p_grhs' pretty groupStyle)) grhssGRHSs newlineSep (located' (p_grhs' pretty groupStyle)) grhssGRHSs
let whereLocation = combineSrcSpans patGrhssSpan $ getLoc grhssLocalBinds
unless unless
(GHC.isEmptyLocalBindsPR (unLoc grhssLocalBinds)) (GHC.isEmptyLocalBindsPR (unLoc grhssLocalBinds))
(inciLocalBinds $ do (inciLocalBinds . switchLayout whereLocation $ do
newline breakpoint
line (txt "where") txt "where"
breakpoint
inci (located grhssLocalBinds p_hsLocalBinds) inci (located grhssLocalBinds p_hsLocalBinds)
) )
case style of case style of