summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/EvilSplicer.hs8
-rw-r--r--standalone/no-th/evilsplicer-headers.hs1
2 files changed, 9 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
diff --git a/standalone/no-th/evilsplicer-headers.hs b/standalone/no-th/evilsplicer-headers.hs
index 1ba0f3dc3..68a1eb3b2 100644
--- a/standalone/no-th/evilsplicer-headers.hs
+++ b/standalone/no-th/evilsplicer-headers.hs
@@ -35,6 +35,7 @@ import qualified Data.ByteString.Unsafe
import qualified Data.ByteString.Char8
import qualified Database.Persist.Class as Database.Persist.Class.PersistField
import qualified Database.Persist.Sql as Database.Persist.Sql.Class
+import qualified Database.Persist.Sql.Class as Database.Persist.Types.Base
{- End EvilSplicer headers. -}