EvilSplicer hacks for persistent
This commit is contained in:
parent
52cba8242b
commit
a419a56c45
2 changed files with 9 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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. -}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue