summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-04-17 00:45:55 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-04-17 00:51:29 -0400
commit48c38c3849d67f19c2188a30503acdced726ef2b (patch)
tree2a120d642cf01a966645e04ce12e57a5d9f7a5a1
parentb89ff59fc0e94276bbd871abb4c814338d073d1d (diff)
very close now.. but still so far
-rw-r--r--Build/EvilSplicer.hs33
-rw-r--r--Makefile2
2 files changed, 26 insertions, 9 deletions
diff --git a/Build/EvilSplicer.hs b/Build/EvilSplicer.hs
index a1622dd59..b717b5621 100644
--- a/Build/EvilSplicer.hs
+++ b/Build/EvilSplicer.hs
@@ -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.
diff --git a/Makefile b/Makefile
index b45dea0ec..ac2958bde 100644
--- a/Makefile
+++ b/Makefile
@@ -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 \