Skip to content

Commit

Permalink
conduit 1.1 support
Browse files Browse the repository at this point in the history
  • Loading branch information
snoyberg committed Mar 27, 2014
1 parent 74ea262 commit 4a7cbee
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 9 deletions.
6 changes: 6 additions & 0 deletions persistent-mongoDB/Database/Persist/MongoDB.hs
Expand Up @@ -113,6 +113,8 @@ import Data.Char (toUpper)
import Data.Word (Word16)
import Data.Monoid (mappend)
import Data.Typeable
import Control.Monad.Trans.Resource (MonadThrow (..))
import Control.Monad.Trans.Control (MonadBaseControl)

#ifdef DEBUG
import FileLocation (debug)
Expand Down Expand Up @@ -392,7 +394,11 @@ instance (Applicative m, Functor m, Trans.MonadIO m, MonadBaseControl IO m) => P
t = entityDef $ Just $ dummyFromKey k

instance MonadThrow m => MonadThrow (DB.Action m) where
#if MIN_VERSION_resourcet(1,1,0)
throwM = lift . throwM
#else
monadThrow = lift . monadThrow
#endif

instance (Applicative m, Functor m, Trans.MonadIO m, MonadBaseControl IO m) => PersistUnique (DB.Action m) where
getBy uniq = do
Expand Down
2 changes: 1 addition & 1 deletion persistent-mongoDB/persistent-mongoDB.cabal
@@ -1,5 +1,5 @@
name: persistent-mongoDB
version: 1.3.0.3
version: 1.3.0.4
license: MIT
license-file: LICENSE
author: Greg Weber <greg@gregweber.info>
Expand Down
2 changes: 2 additions & 0 deletions persistent-mysql/Database/Persist/MySQL.hs
Expand Up @@ -47,6 +47,8 @@ import qualified Database.MySQL.Simple.Types as MySQL

import qualified Database.MySQL.Base as MySQLBase
import qualified Database.MySQL.Base.Types as MySQLBase
import Control.Monad.Trans.Control (MonadBaseControl)
import Control.Monad.Trans.Resource (MonadResource, runResourceT)


-- | Create a MySQL connection pool and run the given action.
Expand Down
3 changes: 2 additions & 1 deletion persistent-mysql/persistent-mysql.cabal
@@ -1,5 +1,5 @@
name: persistent-mysql
version: 1.3.0.1
version: 1.3.0.2
license: MIT
license-file: LICENSE
author: Felipe Lessa <felipe.lessa@gmail.com>, Michael Snoyman
Expand Down Expand Up @@ -37,6 +37,7 @@ library
, monad-control >= 0.2
, aeson >= 0.5
, conduit >= 0.5.3
, resourcet
exposed-modules: Database.Persist.MySQL
ghc-options: -Wall

Expand Down
2 changes: 2 additions & 0 deletions persistent-postgresql/Database/Persist/Postgresql.hs
Expand Up @@ -19,6 +19,8 @@ module Database.Persist.Postgresql

import Database.Persist.Sql
import Data.Fixed (Pico)
import Control.Monad.Trans.Control (MonadBaseControl)
import Control.Monad.Trans.Resource (MonadResource, runResourceT)

import qualified Database.PostgreSQL.Simple as PG
import qualified Database.PostgreSQL.Simple.BuiltinTypes as PG
Expand Down
3 changes: 2 additions & 1 deletion persistent-postgresql/persistent-postgresql.cabal
@@ -1,5 +1,5 @@
name: persistent-postgresql
version: 1.3.0.3
version: 1.3.0.4
license: MIT
license-file: LICENSE
author: Felipe Lessa, Michael Snoyman <michael@snoyman.com>
Expand Down Expand Up @@ -27,6 +27,7 @@ library
, time >= 1.1
, aeson >= 0.5
, conduit >= 0.5.3
, resourcet
exposed-modules: Database.Persist.Postgresql
ghc-options: -Wall

Expand Down
2 changes: 2 additions & 0 deletions persistent-sqlite/Database/Persist/Sqlite.hs
Expand Up @@ -34,6 +34,8 @@ import Control.Applicative
import Data.Int (Int64)
import Control.Monad ((>=>))
import Data.Monoid ((<>))
import Control.Monad.Trans.Control (MonadBaseControl)
import Control.Monad.Trans.Resource (ResourceT, MonadResource, runResourceT)

createSqlitePool :: MonadIO m => Text -> Int -> m ConnectionPool
createSqlitePool s = createSqlPool $ open' s
Expand Down
3 changes: 2 additions & 1 deletion persistent-sqlite/persistent-sqlite.cabal
@@ -1,5 +1,5 @@
name: persistent-sqlite
version: 1.3.0.3
version: 1.3.0.4
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
Expand Down Expand Up @@ -31,6 +31,7 @@ library
, aeson >= 0.5
, conduit >= 0.5.3
, monad-logger >= 0.2.4
, resourcet
exposed-modules: Database.Sqlite
Database.Persist.Sqlite
ghc-options: -Wall
Expand Down
2 changes: 1 addition & 1 deletion persistent-template/persistent-template.cabal
@@ -1,5 +1,5 @@
name: persistent-template
version: 1.3.1.2
version: 1.3.1.3
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
Expand Down
1 change: 1 addition & 0 deletions persistent/Database/Persist/Sql/Orphan/PersistQuery.hs
Expand Up @@ -20,6 +20,7 @@ import Data.Int (Int64)
import Control.Monad.Logger
import Control.Monad.IO.Class
import Control.Monad.Trans.Class
import Control.Monad.Trans.Resource (MonadResource)
import Control.Exception (throwIO)
import qualified Data.Conduit.List as CL
import Data.Conduit
Expand Down
3 changes: 2 additions & 1 deletion persistent/Database/Persist/Sql/Orphan/PersistStore.hs
Expand Up @@ -18,8 +18,9 @@ import Control.Monad.IO.Class
import Data.ByteString.Char8 (readInteger)
import Data.Maybe (isJust)
import Data.List (find)
import Control.Monad.Trans.Resource (MonadResource)

instance (C.MonadResource m, MonadLogger m) => PersistStore (SqlPersistT m) where
instance (MonadResource m, MonadLogger m) => PersistStore (SqlPersistT m) where
type PersistMonadBackend (SqlPersistT m) = SqlBackend
insert val = do
conn <- askSqlConn
Expand Down
1 change: 1 addition & 0 deletions persistent/Database/Persist/Sql/Orphan/PersistUnique.hs
Expand Up @@ -12,6 +12,7 @@ import Data.Monoid ((<>))
import Control.Monad.Logger
import qualified Data.Conduit.List as CL
import Data.Conduit
import Control.Monad.Trans.Resource (MonadResource)

instance (MonadResource m, MonadLogger m) => PersistUnique (SqlPersistT m) where
deleteBy uniq = do
Expand Down
1 change: 1 addition & 0 deletions persistent/Database/Persist/Sql/Raw.hs
Expand Up @@ -16,6 +16,7 @@ import Data.Int (Int64)
import Control.Monad.Trans.Class (lift)
import qualified Data.Text as T
import Data.Conduit
import Control.Monad.Trans.Resource (MonadResource)

rawQuery :: (MonadSqlPersist m, MonadResource m)
=> Text
Expand Down
6 changes: 6 additions & 0 deletions persistent/Database/Persist/Sql/Types.hs
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE TypeFamilies #-}
Expand Down Expand Up @@ -93,8 +94,13 @@ type SqlPersist = SqlPersistT

type SqlPersistM = SqlPersistT (NoLoggingT (ResourceT IO))

#if MIN_VERSION_resourcet(1,1,0)
instance MonadThrow m => MonadThrow (SqlPersistT m) where
throwM = lift . throwM
#else
instance MonadThrow m => MonadThrow (SqlPersistT m) where
monadThrow = lift . monadThrow
#endif

instance MonadBase backend m => MonadBase backend (SqlPersistT m) where
liftBase = lift . liftBase
Expand Down
2 changes: 1 addition & 1 deletion persistent/persistent.cabal
@@ -1,5 +1,5 @@
name: persistent
version: 1.3.0.4
version: 1.3.0.5
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
Expand Down
4 changes: 2 additions & 2 deletions pool-conduit/pool-conduit.cabal
@@ -1,5 +1,5 @@
name: pool-conduit
version: 0.1.2.1
version: 0.1.2.2
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
Expand All @@ -18,7 +18,7 @@ library
build-depends: base >= 4 && < 5
, resource-pool >= 0.2.1 && < 0.3
, transformers >= 0.2.1
, resourcet >= 0.3 && < 0.5
, resourcet >= 0.3 && < 1.2
, monad-control

exposed-modules: Data.Conduit.Pool
Expand Down

0 comments on commit 4a7cbee

Please sign in to comment.