From fc2940a6069ce52e52305d211591e9d86a5a158b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 22 Feb 2015 15:43:59 -0400 Subject: EvilSplicer hacks for persistent --- Build/EvilSplicer.hs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Build') 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 -- cgit v1.2.3