diff options
author | Joey Hess <joey@kitenet.net> | 2013-04-18 14:31:39 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-04-18 14:31:39 -0400 |
commit | 581ac9a562fd4286b284663bcffb6be23f73ab57 (patch) | |
tree | c95fb540d6a334418e3ce7a9c6a169a723472e09 /Build | |
parent | 3c8b01835da07994c0934905bf8a9ae6ecf09906 (diff) |
run lambda parenthesisation recursively inside the body of the lambda
Diffstat (limited to 'Build')
-rw-r--r-- | Build/EvilSplicer.hs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Build/EvilSplicer.hs b/Build/EvilSplicer.hs index d50518244..b46a1a63f 100644 --- a/Build/EvilSplicer.hs +++ b/Build/EvilSplicer.hs @@ -317,7 +317,8 @@ mangleCode = lambdaparens - column to the first non-whitespace. This is assumed - to be the expression after the lambda. - - - This does not handle nested unparenthesised lambdas. + - Runs recursively on the body of the lambda, to handle nested + - lambdas. -} lambdaparens = parsecAndReplace $ do string " \\ " @@ -330,9 +331,12 @@ mangleCode = lambdaparens char ' ' l <- restofline return $ indent ++ " " ++ l - return $ " (\\ " ++ lambdaparams ++ "\n" ++ - indent ++ "-> " ++ - intercalate "\n" (firstline:lambdalines) ++ ")\n" + return $ concat + [ " (\\ " ++ lambdaparams ++ "\n" + , indent ++ "-> " + , lambdaparens $ intercalate "\n" (firstline:lambdalines) + , ")\n" + ] restofline = manyTill (noneOf "\n") newline |