Skip to content

Commit

Permalink
Merge pull request #773 from yesodweb/newer-conduit
Browse files Browse the repository at this point in the history
Support new conduit release
  • Loading branch information
snoyberg committed Feb 1, 2018
2 parents bad9ea9 + 49cd445 commit b7f0194
Show file tree
Hide file tree
Showing 33 changed files with 320 additions and 282 deletions.
44 changes: 14 additions & 30 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ addons:
apt:
packages:
- libgmp-dev
- cabal-install-1.24
sources:
- hvr-ghc
postgresql: "9.6"

services:
Expand All @@ -17,37 +14,28 @@ services:

matrix:
include:
- env: ARGS="--resolver lts-2" BACKEND=none
- env: ARGS="--resolver lts-2" BACKEND=sqlite
- env: ARGS="--resolver lts-2" BACKEND=mongodb
- env: ARGS="--resolver lts-2" BACKEND=postgresql
- env: ARGS="--resolver lts-2" BACKEND=mysql

- env: ARGS="--resolver lts-6" BACKEND=none
- env: ARGS="--resolver lts-6" BACKEND=sqlite
- env: ARGS="--resolver lts-6" BACKEND=mongodb
- env: ARGS="--resolver lts-6" BACKEND=postgresql
- env: ARGS="--resolver lts-6" BACKEND=mysql
- env: ARGS="--resolver lts-7" BACKEND=none
- env: ARGS="--resolver lts-9" BACKEND=none
- env: ARGS="--resolver lts-10" BACKEND=none

- env: ARGS="--resolver lts-9" BACKEND=sqlite
- env: ARGS="--resolver lts-9" BACKEND=mongodb
- env: ARGS="--resolver lts-9" BACKEND=postgresql
- env: ARGS="--resolver lts-9" BACKEND=mysql

- env: ARGS="" BACKEND=none
- env: ARGS="" BACKEND=sqlite
- env: ARGS="" BACKEND=mongodb
- env: ARGS="" BACKEND=postgresql
- env: ARGS="" BACKEND=mysql
- env: ARGS="--resolver lts-10" BACKEND=sqlite
- env: ARGS="--resolver lts-10" BACKEND=mongodb
- env: ARGS="--resolver lts-10" BACKEND=postgresql
- env: ARGS="--resolver lts-10" BACKEND=mysql

before_install:
# Download and unpack the stack executable
- mkdir -p ~/.local/bin
- export PATH=$HOME/.local/bin:/opt/cabal/1.24/bin:$PATH
- export PATH=$HOME/.local/bin:$PATH
- travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'

# *TEMPORARY* A proposed change #717 uses haskell-src-meta, which requires
# `happy` to build haskell-src-exts. This fails in lts-2. Revert to the
# commented out line if #717 is not merged, or when testing lts-2 is dropped.
# script: travis/run.sh
script:
- if [[ $ARGS =~ lts-2 ]]; then stack $ARGS --install-ghc install happy; fi
- travis/run.sh
script: travis/run.sh

cache:
directories:
Expand All @@ -60,7 +48,3 @@ cache:
# packages:
# - libzookeeper-mt-dev
# - zookeeperd

after_failure:
- cat ~/.cabal/logs/*log

4 changes: 4 additions & 0 deletions persistent-mongoDB/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.8.0

* Switch from `MonadBaseControl` to `MonadUnliftIO`

## 2.6.0

* Fix upsert behavior [#613](https://github.com/yesodweb/persistent/issues/613)
Expand Down
16 changes: 10 additions & 6 deletions persistent-mongoDB/Database/Persist/MongoDB.hs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ import Data.Bits (shiftR)
import Data.Word (Word16)
import Data.Monoid (mappend)
import Control.Monad.Trans.Reader (ask, runReaderT)
import Control.Monad.Trans.Control (MonadBaseControl)
import Control.Monad.IO.Unlift (MonadUnliftIO, withRunInIO)
import Numeric (readHex)
import Unsafe.Coerce (unsafeCoerce)

Expand Down Expand Up @@ -362,17 +362,21 @@ withMongoDBPool dbname hostname port mauth poolStripes stripeConnections connect
connectionReader pool

-- | run a pool created with 'createMongoDBPipePool'
runMongoDBPipePool :: (Trans.MonadIO m, MonadBaseControl IO m) => DB.AccessMode -> Database -> DB.Action m a -> PipePool -> m a
runMongoDBPipePool :: MonadUnliftIO m => DB.AccessMode -> Database -> DB.Action m a -> PipePool -> m a
runMongoDBPipePool accessMode db action pool =
Pool.withResource pool $ \pipe -> DB.access pipe accessMode db action
withRunInIO $ \run ->
Pool.withResource pool $ \pipe ->
run $ DB.access pipe accessMode db action

runMongoDBPool :: (Trans.MonadIO m, MonadBaseControl IO m) => DB.AccessMode -> DB.Action m a -> ConnectionPool -> m a
runMongoDBPool :: MonadUnliftIO m => DB.AccessMode -> DB.Action m a -> ConnectionPool -> m a
runMongoDBPool accessMode action pool =
Pool.withResource pool $ \(Connection pipe db) -> DB.access pipe accessMode db action
withRunInIO $ \run ->
Pool.withResource pool $ \(Connection pipe db) ->
run $ DB.access pipe accessMode db action


-- | use default 'AccessMode'
runMongoDBPoolDef :: (Trans.MonadIO m, MonadBaseControl IO m) => DB.Action m a -> ConnectionPool -> m a
runMongoDBPoolDef :: MonadUnliftIO m => DB.Action m a -> ConnectionPool -> m a
runMongoDBPoolDef = runMongoDBPool defaultAccessMode

queryByKey :: (PersistEntity record, PersistEntityBackend record ~ DB.MongoContext)
Expand Down
8 changes: 4 additions & 4 deletions persistent-mongoDB/persistent-mongoDB.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: persistent-mongoDB
version: 2.6.0
version: 2.8.0
license: MIT
license-file: LICENSE
author: Greg Weber <greg@gregweber.info>
Expand All @@ -19,8 +19,8 @@ Flag high_precision_date
Default: False

library
build-depends: base >= 4.6 && < 5
, persistent >= 2.5 && < 3
build-depends: base >= 4.8 && < 5
, persistent >= 2.8 && < 3
, text >= 0.8
, transformers >= 0.2.1
, containers >= 0.2
Expand All @@ -33,12 +33,12 @@ library
, cereal >= 0.3.0.0
, path-pieces >= 0.1
, http-api-data >= 0.2 && < 0.4
, monad-control >= 0.3
, aeson >= 0.6.2
, attoparsec
, time
, bytestring
, resource-pool < 0.3
, unliftio-core

exposed-modules: Database.Persist.MongoDB
ghc-options: -Wall
Expand Down
6 changes: 5 additions & 1 deletion persistent-mysql/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
## Unreleased
## 2.8.0 (Unreleased)

* Switch from `MonadBaseControl` to `MonadUnliftIO`
* Fix duplicate migrations when using `mediumtext`, `longtext`, `mediumblob`, `longblob`, and `double`s using a custom precision. [#754](https://github.com/yesodweb/persistent/pull/754)

-- This can be released as a minor change on the next update. Currently persistent-mysql can't be released because 2.6.2.2 depends on persistent-2.7.2 being released.

* The `SomeField` type was renamed to `HandleUpdateCollision` and deprecated. Please migrate to using `HandleUpdateCollision`.
* The `SomeField` constructor was deprecated, and a temporary pattern synonym introduced. Please migrate to using `copyField`.

## 2.6.2.2 [UNRELEASED ON HACKAGE]

-- This version depends on persistent 2.7.2, which introduced breaking changes and is deprecated on hackage.
Expand Down
Loading

0 comments on commit b7f0194

Please sign in to comment.