Remove regex-tdfa-text to allow building in GHC 7.10

Fixes #212
This commit is contained in:
Joe Nelson
2015-07-01 21:55:35 -07:00
parent 25492a089b
commit 6604293ac1
4 changed files with 9 additions and 11 deletions
+3 -4
View File
@@ -11,7 +11,6 @@ import qualified Hasql.Backend as B
import qualified Data.Text as T
import Text.Regex.TDFA ( (=~) )
import Text.Regex.TDFA.Text ()
import qualified Network.HTTP.Types.URI as Net
import qualified Data.ByteString.Char8 as BS
import Data.Monoid
@@ -252,18 +251,18 @@ pgFmtJsonbPath p =
pgFmtIdent :: T.Text -> T.Text
pgFmtIdent x =
let escaped = T.replace "\"" "\"\"" (trimNullChars $ cs x) in
if escaped =~ danger
if (cs escaped :: BS.ByteString) =~ danger
then "\"" <> escaped <> "\""
else escaped
where danger = "^$|^[^a-z_]|[^a-z_0-9]" :: T.Text
where danger = "^$|^[^a-z_]|[^a-z_0-9]" :: BS.ByteString
pgFmtLit :: T.Text -> T.Text
pgFmtLit x =
let trimmed = trimNullChars x
escaped = "'" <> T.replace "'" "''" trimmed <> "'"
slashed = T.replace "\\" "\\\\" escaped in
cs $ if escaped =~ ("\\\\" :: T.Text)
if T.isInfixOf "\\\\" escaped
then "E" <> slashed
else slashed