snaplet-postgresql-simple 1.0.1.0 → 1.0.2.0
raw patch · 3 files changed
+7/−5 lines, 3 files
Files
- snaplet-postgresql-simple.cabal +2/−2
- src/Snap/Snaplet/PostgresqlSimple.hs +4/−2
- src/Snap/Snaplet/PostgresqlSimple/Internal.hs +1/−1
snaplet-postgresql-simple.cabal view
@@ -1,5 +1,5 @@ name: snaplet-postgresql-simple-version: 1.0.1.0+version: 1.0.2.0 synopsis: postgresql-simple snaplet for the Snap Framework description: This snaplet contains support for using the Postgresql database with a Snap Framework application via the@@ -43,7 +43,7 @@ bytestring >= 0.9.1 && < 0.11, clientsession >= 0.7.2 && < 0.10, configurator >= 0.2 && < 0.4,- lens < 4.15,+ lens >= 3.7.6 && < 4.16, lifted-base >= 0.2 && < 0.3, monad-control >= 1.0 && < 1.1, mtl >= 2 && < 2.3,
src/Snap/Snaplet/PostgresqlSimple.hs view
@@ -172,14 +172,16 @@ -- -- > d <- nestSnaplet "db" db pgsInit -- > count <- liftIO $ runReaderT (execute "INSERT ..." params) d-instance (MonadIO m, MonadBaseControl IO m) => HasPostgres (ReaderT (Snaplet Postgres) m) where+instance {-# OVERLAPPING #-} (MonadIO m, MonadBaseControl IO m)+ => HasPostgres (ReaderT (Snaplet Postgres) m) where getPostgresState = asks (^# snapletValue) setLocalPostgresState s = local (set snapletValue s) ------------------------------------------------------------------------------ -- | A convenience instance to make it easier to use functions written for -- this snaplet in non-snaplet contexts.-instance (MonadIO m, MonadBaseControl IO m) => HasPostgres (ReaderT Postgres m) where+instance {-# OVERLAPPING #-} (MonadIO m, MonadBaseControl IO m)+ => HasPostgres (ReaderT Postgres m) where getPostgresState = ask setLocalPostgresState s = local (const s)
src/Snap/Snaplet/PostgresqlSimple/Internal.hs view
@@ -59,7 +59,7 @@ setLocalPostgresState pg m -instance HasPostgres m => HasPostgres (ReaderT r m) where+instance {-#OVERLAPPABLE #-} HasPostgres m => HasPostgres (ReaderT r m) where getPostgresState = lift getPostgresState setLocalPostgresState pg (ReaderT m) = ReaderT $ \e -> setLocalPostgresState pg (m e)