aboutsummaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-12-10 11:55:56 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-12-10 11:55:56 -0400
commit92534aae659ac9c9c58fea3fc912f06079ad1b6b (patch)
treed5f3dc397335f14e134b4efed355675d6562c82f /Build
parent4436262061afdf974880b02d8d3c1b1330187b01 (diff)
improve hask to work with TH for Free monads
Diffstat (limited to 'Build')
-rw-r--r--Build/EvilSplicer.hs15
1 files changed, 13 insertions, 2 deletions
diff --git a/Build/EvilSplicer.hs b/Build/EvilSplicer.hs
index e685b1e44..a24f265e2 100644
--- a/Build/EvilSplicer.hs
+++ b/Build/EvilSplicer.hs
@@ -474,7 +474,7 @@ mangleCode = flip_colon
-
- To fix, we could just put a semicolon at the start of every line
- containing " -> " ... Except that lambdas also contain that.
- - But we can get around that: GHC outputs lambas like this:
+ - But we can get around that: GHC outputs lambdas like this:
-
- \ foo
- -> bar
@@ -486,6 +486,15 @@ mangleCode = flip_colon
- So, we can put the semicolon at the start of every line
- containing " -> " unless there's a "\ " first, or it's
- all whitespace up until it.
+ -
+ - Except.. type signatures also contain " -> " sometimes starting
+ - a line:
+ -
+ - forall foo =>
+ - Foo ->
+ -
+ - To detect and avoid these, note that ghc puts 2 spaces
+ - before the "->"
-}
case_layout = parsecAndReplace $ do
void newline
@@ -497,7 +506,9 @@ mangleCode = flip_colon
then unexpected "lambda expression"
else if null prefix
then unexpected "second line of lambda"
- else return $ "\n" ++ indent1 ++ "; " ++ prefix ++ " -> "
+ else if " " `isSuffixOf` prefix
+ then unexpected "probably type signature"
+ else return $ "\n" ++ indent1 ++ "; " ++ prefix ++ " -> "
{- Sometimes cases themselves span multiple lines:
-
- Nothing