packages feed

groundhog-postgresql 0.10 → 0.11

raw patch · 5 files changed

+17/−18 lines, 5 filesdep −blaze-builderdep −semigroupsdep ~groundhogPVP ok

version bump matches the API change (PVP)

Dependencies removed: blaze-builder, semigroups

Dependency ranges changed: groundhog

API changes (from Hackage documentation)

Files

Database/Groundhog/Postgresql.hs view
@@ -49,7 +49,6 @@ import Data.IORef import Data.List (groupBy, intercalate, isPrefixOf, stripPrefix) import Data.Maybe (fromJust, fromMaybe, isJust, mapMaybe)-import Data.Monoid hiding ((<>)) import Data.Pool import Data.Time.LocalTime (localTimeToUTC, utc) 
Database/Groundhog/Postgresql/Array.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE TypeFamilies, FlexibleContexts, FlexibleInstances, OverloadedStrings, UndecidableInstances, OverlappingInstances, BangPatterns #-}
+{-# LANGUAGE TypeFamilies, FlexibleContexts, FlexibleInstances, OverloadedStrings, UndecidableInstances, BangPatterns #-}
 
 -- | See detailed documentation for PostgreSQL arrays at http://www.postgresql.org/docs/9.2/static/arrays.html and http://www.postgresql.org/docs/9.2/static/functions-array.html
 module Database.Groundhog.Postgresql.Array
@@ -29,8 +29,6 @@ import Database.Groundhog.Generic.Sql hiding (append)
 import Database.Groundhog.Postgresql hiding (append)
 
-import Blaze.ByteString.Builder (fromByteString, toByteString)
-import Blaze.ByteString.Builder.Word (fromWord8)
 import Control.Applicative
 import Control.Monad (mzero)
 import qualified Data.Aeson as A
@@ -39,7 +37,9 @@ import qualified Data.Attoparsec.Zepto as Z
 import Data.ByteString.Char8 (ByteString)
 import qualified Data.ByteString as B
+import qualified Data.ByteString.Lazy as B (toStrict)
 import qualified Data.ByteString.Unsafe as B
+import qualified Data.ByteString.Builder as B
 import Data.Monoid hiding ((<>))
 import Data.Word
 import qualified Data.Vector as V
@@ -71,10 +71,10 @@ class ArrayElem a where
   parseElem :: Parser a
 
-instance ArrayElem a => ArrayElem (Array a) where
+instance {-# OVERLAPPABLE #-} ArrayElem a => ArrayElem (Array a) where
   parseElem = parseArr
 
-instance PrimitivePersistField a => ArrayElem a where
+instance {-# OVERLAPPABLE #-} PrimitivePersistField a => ArrayElem a where
   parseElem = fmap (fromPrimitivePersistValue . PersistByteString) parseString
 
 instance (ArrayElem a, PrimitivePersistField a) => PrimitivePersistField (Array a) where
@@ -107,7 +107,7 @@ 
 -- Borrowed from aeson
 unescape :: Z.Parser ByteString
-unescape = toByteString <$> go mempty where
+unescape = B.toStrict <$> B.toLazyByteString <$> go mempty where
   go acc = do
     h <- Z.takeWhile (/=backslash)
     let rest = do
@@ -120,12 +120,12 @@           if slash /= backslash || escape == 255
             then fail "invalid array escape sequence"
             else do
-            let cont m = go (acc `mappend` fromByteString h `mappend` m)
+            let cont m = go (acc `mappend` B.byteString h `mappend` m)
                 {-# INLINE cont #-}
-            cont (fromWord8 escape)
+            cont (B.word8 escape)
     done <- Z.atEnd
     if done
-      then return (acc `mappend` fromByteString h)
+      then return (acc `mappend` B.byteString h)
       else rest
 
 doubleQuote, backslash :: Word8
Database/Groundhog/Postgresql/HStore.hs view
@@ -35,7 +35,8 @@ import Database.PostgreSQL.Simple.HStore  import Data.Aeson (Value)-import qualified Blaze.ByteString.Builder as B+import qualified Data.ByteString.Builder as B+import qualified Data.ByteString.Lazy as B (toStrict) import Control.Applicative import qualified Data.Map as Map import Data.String@@ -53,7 +54,7 @@   dbType _ _ = DbTypePrimitive (DbOther $ OtherTypeDef $ [Left "hstore"]) False Nothing Nothing  instance PrimitivePersistField HStore where-  toPrimitivePersistValue (HStore a) = PersistCustom "E?::hstore" [toPrimitivePersistValue $ T.decodeUtf8 $ B.toByteString $ toBuilder (toHStore (HStoreMap a))]+  toPrimitivePersistValue (HStore a) = PersistCustom "E?::hstore" [toPrimitivePersistValue $ T.decodeUtf8 $ B.toStrict $ toLazyByteString (toHStore (HStoreMap a))]   fromPrimitivePersistValue x = case parseHStoreList $ fromPrimitivePersistValue x of      Left err -> error $ "HStore: " ++ err      Right (HStoreList val) -> HStore $ Map.fromList val
changelog view
@@ -1,3 +1,6 @@+0.11+* Support for GHC 8.8+ 0.10 * Pass type information along the UntypedExpr * Fix #57 (table indexes are ignored)
groundhog-postgresql.cabal view
@@ -1,5 +1,5 @@ name:            groundhog-postgresql-version:         0.10+version:         0.11 license:         BSD3 license-file:    LICENSE author:          Boris Lykah <lykahb@gmail.com>@@ -20,9 +20,8 @@                    , postgresql-simple        >= 0.3       && < 0.7                    , postgresql-libpq         >= 0.6.1                    , bytestring               >= 0.9-                   , blaze-builder            >= 0.3       && < 0.5                    , transformers             >= 0.2.1     && < 0.6-                   , groundhog                >= 0.10      && < 0.11+                   , groundhog                >= 0.11      && < 0.12                    , monad-control            >= 0.3       && < 1.1                    , containers               >= 0.2                    , text                     >= 0.8@@ -33,9 +32,6 @@                    , vector                   >= 0.10     && < 0.13                    , resourcet                >= 1.1.2 -    -- See https://prime.haskell.org/wiki/Libraries/Proposals/SemigroupMonoid#Writingcompatiblecode-    if !impl(ghc >= 8.0)-      build-depends: semigroups      exposed-modules: Database.Groundhog.Postgresql                      Database.Groundhog.Postgresql.Array