finish fixing android build after tor merge

This commit is contained in:
Joey Hess 2016-12-12 13:27:39 -04:00
parent a52c011581
commit ce2828a12f
No known key found for this signature in database
GPG key ID: C910D9222512E3C7

View file

@ -486,18 +486,8 @@ mangleCode = flip_colon
- So, we can put the semicolon at the start of every line - So, we can put the semicolon at the start of every line
- containing " -> " unless there's a "\ " first, or it's - containing " -> " unless there's a "\ " first, or it's
- all whitespace up until it. - all whitespace up until it.
-
- Except.. type signatures also contain " -> " sometimes starting
- a line:
-
- forall foo =>
- Foo ->
-
- To avoid breaking these, look for the => on the previous line.
-} -}
case_layout = parsecAndReplace $ do case_layout = skipfree $ parsecAndReplace $ do
void newline
lastline <- restOfLine
void newline void newline
indent1 <- many1 $ char ' ' indent1 <- many1 $ char ' '
prefix <- manyTill (noneOf "\n") (try (string "-> ")) prefix <- manyTill (noneOf "\n") (try (string "-> "))
@ -507,9 +497,7 @@ mangleCode = flip_colon
then unexpected "lambda expression" then unexpected "lambda expression"
else if null prefix else if null prefix
then unexpected "second line of lambda" then unexpected "second line of lambda"
else if "=>" `isSuffixOf` lastline else return $ "\n" ++ indent1 ++ "; " ++ prefix ++ " -> "
then unexpected "probably type signature"
else return $ "\n" ++ lastline ++ "\n" ++ indent1 ++ "; " ++ prefix ++ " -> "
{- Sometimes cases themselves span multiple lines: {- Sometimes cases themselves span multiple lines:
- -
- Nothing - Nothing
@ -520,7 +508,7 @@ mangleCode = flip_colon
- var var - var var
- -> foo - -> foo
-} -}
case_layout_multiline = parsecAndReplace $ do case_layout_multiline = skipfree $ parsecAndReplace $ do
void newline void newline
indent1 <- many1 $ char ' ' indent1 <- many1 $ char ' '
firstline <- restofline firstline <- restofline
@ -533,6 +521,11 @@ mangleCode = flip_colon
else return $ "\n" ++ indent1 ++ "; " ++ firstline ++ "\n" else return $ "\n" ++ indent1 ++ "; " ++ firstline ++ "\n"
++ indent1 ++ indent2 ++ "-> " ++ indent1 ++ indent2 ++ "-> "
{- Type definitions for free monads triggers the case_* hacks, avoid. -}
skipfree f s
| "MonadFree" `isInfixOf` s = s
| otherwise = f s
{- (foo, \ -> bar) is not valid haskell, GHC. {- (foo, \ -> bar) is not valid haskell, GHC.
- Change to (foo, bar) - Change to (foo, bar)
- -