summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-02-22 15:43:59 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-02-22 15:43:59 -0400
commitfc2940a6069ce52e52305d211591e9d86a5a158b (patch)
treeac62db6c70b01f38d6576adfc360aa82efb22386 /Build
parentcee6bc04be95a1338ff4cbd3090f690e693619c5 (diff)
EvilSplicer hacks for persistent
Diffstat (limited to 'Build')
-rw-r--r--Build/EvilSplicer.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/Build/EvilSplicer.hs b/Build/EvilSplicer.hs
index 1fd64670b..70fe2d5be 100644
--- a/Build/EvilSplicer.hs
+++ b/Build/EvilSplicer.hs
@@ -301,6 +301,7 @@ expandExpressionSplice sp lls = concat [before, spliced:padding, end]
{- Tweaks code output by GHC in splices to actually build. Yipes. -}
mangleCode :: String -> String
mangleCode = flip_colon
+ . persist_dequalify_hack
. remove_unnecessary_type_signatures
. lambdaparenhack
. lambdaparens
@@ -554,6 +555,13 @@ mangleCode = flip_colon
- The ; is added by case_layout. -}
flip_colon = replace "; : _ " "; _ : "
+ {- TH for persistent has some qualified symbols in places
+ - that are not allowed. -}
+ persist_dequalify_hack = replace "Database.Persist.TH.++" "++"
+ . replace "Database.Persist.Sql.Class.sqlType" "sqlType"
+ . replace "Database.Persist.Class.PersistField.toPersistValue" "toPersistValue"
+ . replace "Database.Persist.Class.PersistField.fromPersistValue" "fromPersistValue"
+
{- Embedded files use unsafe packing, which is problimatic
- for several reasons, including that GHC sometimes omits trailing
- newlines in the file content, which leads to the wrong byte