run lambda parenthesisation recursively inside the body of the lambda
This commit is contained in:
parent
b86712ca80
commit
6ee4c2038e
1 changed files with 8 additions and 4 deletions
|
@ -317,7 +317,8 @@ mangleCode = lambdaparens
|
||||||
- column to the first non-whitespace. This is assumed
|
- column to the first non-whitespace. This is assumed
|
||||||
- to be the expression after the lambda.
|
- 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
|
lambdaparens = parsecAndReplace $ do
|
||||||
string " \\ "
|
string " \\ "
|
||||||
|
@ -330,9 +331,12 @@ mangleCode = lambdaparens
|
||||||
char ' '
|
char ' '
|
||||||
l <- restofline
|
l <- restofline
|
||||||
return $ indent ++ " " ++ l
|
return $ indent ++ " " ++ l
|
||||||
return $ " (\\ " ++ lambdaparams ++ "\n" ++
|
return $ concat
|
||||||
indent ++ "-> " ++
|
[ " (\\ " ++ lambdaparams ++ "\n"
|
||||||
intercalate "\n" (firstline:lambdalines) ++ ")\n"
|
, indent ++ "-> "
|
||||||
|
, lambdaparens $ intercalate "\n" (firstline:lambdalines)
|
||||||
|
, ")\n"
|
||||||
|
]
|
||||||
|
|
||||||
restofline = manyTill (noneOf "\n") newline
|
restofline = manyTill (noneOf "\n") newline
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue