summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-04-14 16:53:41 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-04-14 16:53:41 -0400
commited9a776490b645667402aa6da87b0a0194a98c25 (patch)
tree6dd78814d35bee7927f5c9f7a301f6c2a89b923e /Build
parentfd3de4f173ca171d06948226236d3beacd5fcc5a (diff)
hack around incorrect nested instance code generated by GHC
Yesod-specific hack for now.
Diffstat (limited to 'Build')
-rw-r--r--Build/EvilSplicer.hs14
1 files changed, 13 insertions, 1 deletions
diff --git a/Build/EvilSplicer.hs b/Build/EvilSplicer.hs
index f7083aa27..66032bad7 100644
--- a/Build/EvilSplicer.hs
+++ b/Build/EvilSplicer.hs
@@ -280,11 +280,23 @@ expandExpressionSplice s lls = concat [before, new:splicerest, end]
{- Tweaks code output by GHC in splices to actually build. Yipes. -}
mangleCode :: String -> String
-mangleCode = fix_bad_escape . remove_package_version
+mangleCode = nested_instances . fix_bad_escape . remove_package_version
where
{- GHC may incorrectly escape "}" within a multi-line string. -}
fix_bad_escape = replace " \\}" " }"
+ {- GHC may output this:
+ -
+ - instance RenderRoute WebApp where
+ - data instance Route WebApp
+ - ^^^^^^^^
+ - The marked word should not be there.
+ -
+ - FIXME: This is a yesod-specific hack, it should look for the
+ - outer instance.
+ -}
+ nested_instances = replace " data instance Route" " data Route"
+
{- GHC may add full package and version qualifications for
- symbols from unimported modules. We don't want these.
-