on master help sign in
Keep space in lambdas with lazyness annotation
6583ecbDominik Kellner
data/examples/declaration/value/function/lambda-single-line-out.hs+3
@@ -3,3 +3,6 @@ foo x = \y -> x
3
3
4bar :: a -> a -> a
4bar :: a -> a -> a
5bar x = \y -> x
5bar 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
4bar :: a -> a -> a
4bar :: a -> a -> a
5bar x =
5bar x =
6 \y -> x
6 \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
134 PatternBind -> stdCase
134 PatternBind -> stdCase
135 Case -> stdCase
135 Case -> stdCase
136 Lambda -> do
136 Lambda -> do
137+ case unLoc (NE.head ne_pats) of
138+ LazyPat _ _ -> txt "\\ "
137− txt "\\"
139+ _ -> txt "\\"
138 stdCase
140 stdCase
139 LambdaCase -> stdCase
141 LambdaCase -> stdCase
140 return inci'
142 return inci'