aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-12-10 12:13:41 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-12-10 12:13:41 -0400
commitfa73c9bda634770b07bbd1a84dc034c885abddaf (patch)
treefca4864784e549813c1f279424be7fadcf22eedb
parent92534aae659ac9c9c58fea3fc912f06079ad1b6b (diff)
better fix
-rw-r--r--Build/EvilSplicer.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/Build/EvilSplicer.hs b/Build/EvilSplicer.hs
index a24f265e2..425971723 100644
--- a/Build/EvilSplicer.hs
+++ b/Build/EvilSplicer.hs
@@ -491,13 +491,14 @@ mangleCode = flip_colon
- a line:
-
- forall foo =>
- - Foo ->
+ - Foo ->
-
- - To detect and avoid these, note that ghc puts 2 spaces
- - before the "->"
+ - To avoid breaking these, look for the => on the previous line.
-}
case_layout = parsecAndReplace $ do
void newline
+ lastline <- restOfLine
+ void newline
indent1 <- many1 $ char ' '
prefix <- manyTill (noneOf "\n") (try (string "-> "))
if length prefix > 20
@@ -506,7 +507,7 @@ mangleCode = flip_colon
then unexpected "lambda expression"
else if null prefix
then unexpected "second line of lambda"
- else if " " `isSuffixOf` prefix
+ else if "=>" `isSuffixOf` lastline
then unexpected "probably type signature"
else return $ "\n" ++ indent1 ++ "; " ++ prefix ++ " -> "
{- Sometimes cases themselves span multiple lines: