From 23ac8da92ba607c17b99ee47c1d9a687336584e1 Mon Sep 17 00:00:00 2001 From: Matt Parsons Date: Mon, 23 Oct 2017 17:28:47 -0600 Subject: [PATCH] Remove SqlReadT --- src/Database/Esqueleto/Internal/Sql.hs | 20 ++++++-------------- stack-8.0.yaml | 9 ++++++++- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/Database/Esqueleto/Internal/Sql.hs b/src/Database/Esqueleto/Internal/Sql.hs index e6e48ef..80310c0 100644 --- a/src/Database/Esqueleto/Internal/Sql.hs +++ b/src/Database/Esqueleto/Internal/Sql.hs @@ -781,14 +781,6 @@ veryUnsafeCoerceSqlExprValueList EEmptyList = throw (UnexpectedCaseErr EmptySqlE ---------------------------------------------------------------------- -type SqlReadT' m a = forall backend. - ( BackendCompatible SqlBackend backend - , IsPersistBackend backend - , PersistQueryRead backend - , PersistStoreRead backend, PersistUniqueRead backend - ) - => R.ReaderT backend m a - -- | (Internal) Execute an @esqueleto@ @SELECT@ 'SqlQuery' inside -- @persistent@'s 'SqlPersistT' monad. rawSelectSource :: ( SqlSelect a r @@ -797,7 +789,7 @@ rawSelectSource :: ( SqlSelect a r ) => Mode -> SqlQuery a - -> SqlReadT' m1 (Acquire (C.Source m2 r)) + -> SqlReadT m1 (Acquire (C.Source m2 r)) rawSelectSource mode query = do conn <- projectBackend <$> R.ask @@ -881,7 +873,7 @@ selectSource query = do select :: ( SqlSelect a r , MonadIO m ) - => SqlQuery a -> SqlReadT' m [r] + => SqlQuery a -> SqlReadT m [r] select query = do res <- rawSelectSource SELECT query conn <- R.ask @@ -921,12 +913,12 @@ runSource src = src C.$$ CL.consume -- | (Internal) Execute an @esqueleto@ statement inside -- @persistent@'s 'SqlPersistT' monad. -rawEsqueleto :: ( MonadIO m, SqlSelect a r, IsSqlBackend backend) +rawEsqueleto :: ( MonadIO m, SqlSelect a r, BackendCompatible SqlBackend backend) => Mode -> SqlQuery a -> R.ReaderT backend m Int64 rawEsqueleto mode query = do - conn <- persistBackend <$> R.ask + conn <- R.ask uncurry rawExecuteCount $ first builderToText $ toRawSql mode (conn, initialIdentState) query @@ -1008,7 +1000,7 @@ builderToText = TL.toStrict . TLB.toLazyTextWith defaultChunkSize -- possible but tedious), you may just turn on query logging of -- @persistent@. toRawSql - :: (IsSqlBackend backend, SqlSelect a r) + :: (SqlSelect a r, BackendCompatible SqlBackend backend) => Mode -> (backend, IdentState) -> SqlQuery a -> (TLB.Builder, [PersistValue]) toRawSql mode (conn, firstIdentState) query = let ((ret, sd), finalIdentState) = @@ -1028,7 +1020,7 @@ toRawSql mode (conn, firstIdentState) query = -- that were used) to the subsequent calls. This ensures -- that no name clashes will occur on subqueries that may -- appear on the expressions below. - info = (persistBackend conn, finalIdentState) + info = (projectBackend conn, finalIdentState) in mconcat [ makeInsertInto info mode ret , makeSelect info mode distinctClause ret diff --git a/stack-8.0.yaml b/stack-8.0.yaml index 1d884b7..4f41cf0 100644 --- a/stack-8.0.yaml +++ b/stack-8.0.yaml @@ -4,10 +4,17 @@ resolver: lts-8.8 packages: - '.' +- location: + git: https://github.com/parsonsmatt/persistent + commit: a4f21ad5db9b65a5febf79a1be091597210a73ca + subdirs: + - persistent + extra-dep: true + extra-deps: - doctest-prop-0.2.0.1 - quickcheck-properties-0.1 -- persistent-2.7.1 + # - persistent-2.7.1 # - http-client-0.5.0 # - fail-4.9.0.0 # - http-types-0.9