Keep space in lambdas with lazyness annotation
Fixes #144
commit6583ecb3f06606fbf7628cd4b691479a582a7cab
authorDominik Kellner <dkellner@dkellner.de>
dateThu 4 Jul 2019, 21:28 (7 years ago)
parentae40a33
data/examples/declaration/value/function/lambda-single-line-out.hs+3
@@ -3,3 +3,6 @@ foo x = \y -> x
33
44bar :: a -> a -> a
55bar x = \y -> x
6+
7+baz :: a -> a -> a
8+baz = \ ~x ~y -> x
data/examples/declaration/value/function/lambda-single-line.hs+3
@@ -4,3 +4,6 @@ foo x = \y -> x
44bar :: a -> a -> a
55bar x =
66 \y -> x
7+
8+baz :: a -> a -> a
9+baz = \ ~x ~y -> x
src/Ormolu/Printer/Meat/Declaration/Value.hs+3−1
@@ -134,7 +134,9 @@ p_match' placer pretty style isInfix m_pats m_grhss = do
134134 PatternBind -> stdCase
135135 Case -> stdCase
136136 Lambda -> do
137− txt "\\"
137+ case unLoc (NE.head ne_pats) of
138+ LazyPat _ _ -> txt "\\ "
139+ _ -> txt "\\"
138140 stdCase
139141 LambdaCase -> stdCase
140142 return inci'