very close now.. but still so far

This commit is contained in:
Joey Hess 2013-04-17 00:45:55 -04:00
parent e9738fd10d
commit 9fdca995de
2 changed files with 26 additions and 9 deletions

View file

@ -297,6 +297,7 @@ mangleCode = declaration_parens
. nested_instances
. collapse_multiline_strings
. remove_package_version
. emptylambda
where
{- For some reason, GHC sometimes doesn't like the multiline
- strings it creates. It seems to get hung up on \{ at the
@ -339,11 +340,13 @@ mangleCode = declaration_parens
newline
indent <- many1 $ char ' '
prefix <- manyTill (noneOf "\n") (try (string "-> "))
if "\\ " `isInfixOf` prefix
then unexpected "lambda expression"
else if null prefix
then unexpected "second line of lambda"
else return $ "\n" ++ indent ++ "; " ++ prefix ++ " -> "
if length prefix > 10
then unexpected "too long a prefix"
else if "\\ " `isInfixOf` prefix
then unexpected "lambda expression"
else if null prefix
then unexpected "second line of lambda"
else return $ "\n" ++ indent ++ "; " ++ prefix ++ " -> "
{- Sometimes cases themselves span multiple lines:
-
- Nothing
@ -362,6 +365,14 @@ mangleCode = declaration_parens
else return $ "\n" ++ indent ++ "; " ++ firstline ++ "\n"
++ indent ++ indent2 ++ "-> "
{- (foo, \ -> bar) is not valid haskell, GHC.
- Change to (foo, bar)
-
- (Does this ever happen outside a tuple? Only saw
- it inside them..
-}
emptylambda = replace ", \\ -> " ", "
{- GHC may output this:
-
- instance RenderRoute WebApp where
@ -402,12 +413,18 @@ mangleCode = declaration_parens
qualifiedSymbol :: Parser String
qualifiedSymbol = do
token
s <- token
char ':'
token
if length s < 5
then unexpected "too short to be a namespace"
else do
token
token :: Parser String
token = many1 $ satisfy isAlphaNum <|> oneOf "-.'"
token = do
t <- satisfy isLetter
oken <- many $ satisfy isAlphaNum <|> oneOf "-.'"
return $ t:oken
{- This works around a problem in the expanded template haskell for Yesod's
- static site route rendering.

View file

@ -176,7 +176,7 @@ android: Build/EvilSplicer
# Some additional dependencies needed by the expanded splices.
sed -i 's/^ Build-Depends: / Build-Depends: yesod-routes, yesod-core, shakespeare-css, shakespeare-js, shakespeare, blaze-markup, /' tmp/androidtree/git-annex.cabal
# Avoid warnings due to sometimes unused imports added for the splices.
sed -i 's/-Wall//' tmp/androidtree/git-annex.cabal
sed -i 's/-Wall/-Wall -fno-warn-unused-imports/' tmp/androidtree/git-annex.cabal
# Cabal cannot cross compile with custom build type, so workaround.
sed -i 's/Build-type: Custom/Build-type: Simple/' tmp/androidtree/git-annex.cabal
if [ ! -e tmp/androidtree/dist/setup/setup ]; then \