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 = \ ~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 = \ ~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
|
||||
Case -> stdCase
|
||||
Lambda -> do
|
||||
case unLoc (NE.head ne_pats) of
|
||||
LazyPat _ _ -> txt "\\ "
|
||||
_ -> txt "\\"
|
||||
let needsSpace = case unLoc (NE.head ne_pats) of
|
||||
LazyPat _ _ -> True
|
||||
BangPat _ _ -> True
|
||||
SplicePat _ _ -> True
|
||||
_ -> False
|
||||
txt (if needsSpace then "\\ " else "\\")
|
||||
stdCase
|
||||
LambdaCase -> stdCase
|
||||
return inci'
|
||||
|
Loading…
Reference in New Issue
Block a user