mirror of
https://github.com/google/ormolu.git
synced 2024-12-02 23:43:34 +03:00
Bang patterns and splices in lambdas
This commit is contained in:
parent
a7265df09e
commit
b03f989f36
@ -7,3 +7,9 @@ bar x =
|
|||||||
|
|
||||||
baz :: a -> a -> a
|
baz :: a -> a -> a
|
||||||
baz = \ ~x ~y -> x
|
baz = \ ~x ~y -> x
|
||||||
|
|
||||||
|
zag :: a -> a -> a
|
||||||
|
zag = \ !x !y -> x
|
||||||
|
|
||||||
|
spl :: a -> a
|
||||||
|
spl = \ $([p|x|]) -> x
|
||||||
|
@ -7,3 +7,9 @@ bar x =
|
|||||||
|
|
||||||
baz :: a -> a -> a
|
baz :: a -> a -> a
|
||||||
baz = \ ~x ~y -> x
|
baz = \ ~x ~y -> x
|
||||||
|
|
||||||
|
zag :: a -> a -> a
|
||||||
|
zag = \ !x !y -> x
|
||||||
|
|
||||||
|
spl :: a -> a
|
||||||
|
spl = \ $([p|x|]) -> x
|
||||||
|
@ -135,9 +135,12 @@ p_match' placer pretty style isInfix m_pats m_grhss = do
|
|||||||
PatternBind -> stdCase
|
PatternBind -> stdCase
|
||||||
Case -> stdCase
|
Case -> stdCase
|
||||||
Lambda -> do
|
Lambda -> do
|
||||||
case unLoc (NE.head ne_pats) of
|
let needsSpace = case unLoc (NE.head ne_pats) of
|
||||||
LazyPat _ _ -> txt "\\ "
|
LazyPat _ _ -> True
|
||||||
_ -> txt "\\"
|
BangPat _ _ -> True
|
||||||
|
SplicePat _ _ -> True
|
||||||
|
_ -> False
|
||||||
|
txt (if needsSpace then "\\ " else "\\")
|
||||||
stdCase
|
stdCase
|
||||||
LambdaCase -> stdCase
|
LambdaCase -> stdCase
|
||||||
return inci'
|
return inci'
|
||||||
|
Loading…
Reference in New Issue
Block a user