diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-02-22 17:35:51 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-02-22 17:35:51 -0400 |
commit | e48959c77e5d0c86c0b60bd2837cc57940f7635a (patch) | |
tree | d24891cb75c7ebd32b0ad813a646641df58d5831 /Build | |
parent | b97bedd04d6b7766c34413c3625954d4a72b948d (diff) |
a new hack for another ghc invalid haskell syntax in -ddump-splices ..
Diffstat (limited to 'Build')
-rw-r--r-- | Build/EvilSplicer.hs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Build/EvilSplicer.hs b/Build/EvilSplicer.hs index f9a508c11..cca984389 100644 --- a/Build/EvilSplicer.hs +++ b/Build/EvilSplicer.hs @@ -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 |