summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikeLedger <>2015-04-06 00:02:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2015-04-06 00:02:00 (GMT)
commit08fb8b292d6914e6e9c8ce63a7c6d5eff99d3e4b (patch)
treeea5575fa494eeaf4c9c5e29267ac35537f0b3d91
parent579e70f86eaaa7f313533507475f53e40397ee52 (diff)
version 0.0.20.0.2
-rw-r--r--snaplet-hasql.cabal2
-rw-r--r--src/Snap/Snaplet/Hasql.hs15
2 files changed, 8 insertions, 9 deletions
diff --git a/snaplet-hasql.cabal b/snaplet-hasql.cabal
index c0237bd..21a64ad 100644
--- a/snaplet-hasql.cabal
+++ b/snaplet-hasql.cabal
@@ -1,5 +1,5 @@
name: snaplet-hasql
-version: 0.0.1
+version: 0.0.2
synopsis: A Hasql snaplet
license: MIT
license-file: LICENSE
diff --git a/src/Snap/Snaplet/Hasql.hs b/src/Snap/Snaplet/Hasql.hs
index 2f83bdb..4b37793 100644
--- a/src/Snap/Snaplet/Hasql.hs
+++ b/src/Snap/Snaplet/Hasql.hs
@@ -38,22 +38,21 @@ hasqlInit cx p =
return pool
{-# INLINE session #-}
--- | Wrapper around 'session' that just calls 'fail' on failure, and
--- uses the available 'poolLens'. Most useful inside 'Handler`s.
-session :: (HasPool v db, MonadReader v m) => Session db m r -> m r
+-- | Wrapper around 'session' that calls 'fail' on failure.
+session :: HasPool v db => Session db IO r -> Handler b v r
session f = do
db <- view poolLens
- r <- Hasql.session db f
+ r <- liftIO (Hasql.session db f)
case r of
Right a -> return a
Left er -> fail (show er)
{-# INLINE session' #-}
-- | Wrapper around 'session'.
-session' :: (HasPool v db, MonadReader v m)
- => Session db m r
- -> m (Either (SessionError db) r)
+session' :: HasPool v db
+ => Session db IO r
+ -> Handler b v (Either (SessionError db) r)
session' f = do
db <- view poolLens
- Hasql.session db f
+ liftIO (Hasql.session db f)