We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 861cf54 commit 2568684Copy full SHA for 2568684
src/Database/PostgreSQL/Simple/SqlQQ/Interpolated.hs
@@ -5,7 +5,6 @@ module Database.PostgreSQL.Simple.SqlQQ.Interpolated (isql, quoteInterpolatedSql
5
6
import Language.Haskell.TH (Exp, Q, appE, listE, sigE, tupE, varE)
7
import Language.Haskell.TH.Quote (QuasiQuoter (..))
8
-import Data.List (foldl')
9
import Database.PostgreSQL.Simple.ToField (Action, toField)
10
import Database.PostgreSQL.Simple.SqlQQ (sql)
11
import Text.Parsec (ParseError)
@@ -48,12 +47,12 @@ isql = QuasiQuoter
48
47
}
49
50
combineParts :: [StringPart] -> (String, [Q Exp])
51
-combineParts = foldl' step ("", [])
+combineParts = foldr step ("", [])
52
where
53
- step (s, exprs) subExpr = case subExpr of
54
- Lit str -> (s <> str, exprs)
55
- Esc c -> (s <> [c], exprs)
56
- Anti e -> (s <> "?", exprs <> [e]) -- TODO: Make this not slow
+ step subExpr (s, exprs) = case subExpr of
+ Lit str -> (str <> s, exprs)
+ Esc c -> (c : s, exprs)
+ Anti e -> ('?' : s, e : exprs)
57
58
applySql :: [StringPart] -> Q Exp
59
applySql parts =
0 commit comments