packages feed

hasql-postgres 0.3.3 → 0.4.0

raw patch · 5 files changed

+23/−19 lines, 5 filesdep +eitherdep ~mtl-preludePVP ok

version bump matches the API change (PVP)

Dependencies added: either

Dependency ranges changed: mtl-prelude

API changes (from Hackage documentation)

Files

hasql-postgres.cabal view
@@ -1,7 +1,7 @@ name:   hasql-postgres version:-  0.3.3+  0.4.0 synopsis:   A "PostgreSQL" backend for the "hasql" library description:@@ -84,12 +84,13 @@     bytestring >= 0.10.4.0 && < 0.11,     hashable == 1.2.*,     -- control:+    either == 4.*,     list-t >= 0.2.3 && < 0.3,     -- errors:     loch-th == 0.2.*,     placeholders == 0.1.*,     -- general:-    mtl-prelude == 2.0.*,+    mtl-prelude < 3,     base-prelude >= 0.1.3 && < 0.2,     base >= 4.5 && < 4.8 @@ -134,12 +135,13 @@     bytestring >= 0.10.4.0 && < 0.11,     hashable == 1.2.*,     -- control:+    either == 4.*,     list-t >= 0.2.3 && < 0.3,     -- errors:     loch-th == 0.2.*,     placeholders == 0.1.*,     -- general:-    mtl-prelude == 2.0.*,+    mtl-prelude < 3,     base-prelude >= 0.1.3 && < 0.2,     base >= 4.5 && < 4.8 @@ -181,7 +183,7 @@     hashable == 1.2.*,     -- general:     list-t == 0.2.*,-    mtl-prelude == 2.0.*,+    mtl-prelude < 3,     base-prelude >= 0.1.3 && < 0.2,     base >= 4.5 && < 4.8 
library/Hasql/Postgres.hs view
@@ -59,7 +59,7 @@     }   connect p =     do-      r <- runExceptT $ Connector.open settings+      r <- runEitherT $ Connector.open settings       c <- either (\e -> throwIO $ Backend.CantConnect $ fromString $ show e) return r       Connection <$> pure c <*> StatementPreparer.new c <*> newIORef Nothing <*> getIntegerDatetimes c     where
library/Hasql/Postgres/Connector.hs view
@@ -1,9 +1,7 @@--- |--- Mid-level abstractions over gritty details of \"lib-pq\". module Hasql.Postgres.Connector where  import Hasql.Postgres.Prelude hiding (Error)-import qualified Database.PostgreSQL.LibPQ as L+import qualified Database.PostgreSQL.LibPQ as PQ import qualified Data.ByteString as B import qualified Data.ByteString.Builder as BB import qualified Data.ByteString.Lazy as BL@@ -35,20 +33,20 @@  -- | -- Establish and initialize a connection.-open :: Settings -> ExceptT Error IO L.Connection+open :: Settings -> EitherT Error IO PQ.Connection open s =   do-    c <- lift $ L.connectdb (settingsBS s)+    c <- lift $ PQ.connectdb (settingsBS s)     do-      s <- lift $ L.status c-      when (s /= L.ConnectionOk) $ +      s <- lift $ PQ.status c+      when (s /= PQ.ConnectionOk) $          do-          m <- lift $ L.errorMessage c-          throwError $ BadStatus m+          m <- lift $ PQ.errorMessage c+          left $ BadStatus m     do-      v <- lift $ L.serverVersion c-      when (v < 80200) $ throwError $ UnsupportedVersion v-    lift $ L.exec c $ mconcat $ map (<> ";") $ +      v <- lift $ PQ.serverVersion c+      when (v < 80200) $ left $ UnsupportedVersion v+    lift $ PQ.exec c $ mconcat $ map (<> ";") $        [          "SET client_encoding = 'UTF8'",         "SET client_min_messages TO WARNING"
library/Hasql/Postgres/Prelude.hs view
@@ -12,11 +12,15 @@  -- base-prelude --------------------------import BasePrelude as Exports hiding (assert)+import BasePrelude as Exports hiding (assert, left, right)  -- mtl-prelude ------------------------- import MTLPrelude as Exports hiding (shift)++-- either+-------------------------+import Control.Monad.Trans.Either as Exports  -- list-t -------------------------
library/Hasql/Postgres/TemplateConverter/Parser.hs view
@@ -12,7 +12,7 @@  run :: ByteString -> Parser a -> Either Text a run input parser =-  left fromString $ parseOnly (parser <* endOfInput) input+  either (Left . fromString) Right $ parseOnly (parser <* endOfInput) input  parts :: Parser [Part] parts =