a new hack for another ghc invalid haskell syntax in -ddump-splices ..
This commit is contained in:
parent
496dcf77fc
commit
a4a18a67a5
1 changed files with 15 additions and 1 deletions
|
@ -302,6 +302,7 @@ expandExpressionSplice sp lls = concat [before, spliced:padding, end]
|
|||
mangleCode :: String -> String
|
||||
mangleCode = flip_colon
|
||||
. persist_dequalify_hack
|
||||
. let_do
|
||||
. remove_unnecessary_type_signatures
|
||||
. lambdaparenhack
|
||||
. lambdaparens
|
||||
|
@ -502,7 +503,7 @@ mangleCode = flip_colon
|
|||
nested_instances = replace " data instance Route" " data Route"
|
||||
. replace " data instance Unique" " data Unique"
|
||||
. replace " data instance EntityField" " data EntityField"
|
||||
. replace " type instance PersistEntityBackend" = " type PersistEntityBackend"
|
||||
. replace " type instance PersistEntityBackend" " type PersistEntityBackend"
|
||||
|
||||
{- GHC does not properly parenthesise generated data type
|
||||
- declarations. -}
|
||||
|
@ -565,6 +566,19 @@ mangleCode = flip_colon
|
|||
. replace "Database.Persist.Class.PersistField.toPersistValue" "toPersistValue"
|
||||
. replace "Database.Persist.Class.PersistField.fromPersistValue" "fromPersistValue"
|
||||
|
||||
{- Sometimes generates invalid bracketed code with a let
|
||||
- expression:
|
||||
-
|
||||
- foo = do { let x = foo;
|
||||
- use foo }
|
||||
-
|
||||
- Fix by converting the "let x" to :x <- return $"
|
||||
-}
|
||||
let_do = parsecAndReplace $ do
|
||||
void $ string "= do { let "
|
||||
x <- hstoken
|
||||
return $ "= do { " ++ x ++ " <- return $ "
|
||||
|
||||
{- 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
|
||||
|
|
Loading…
Add table
Reference in a new issue