packages feed

hedis-pile 0.3.1 → 0.4.0

raw patch · 2 files changed

+8/−8 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Database.Redis.Pile: pile :: ByteString -> ByteString -> Maybe (ByteString, ByteString) -> Maybe ByteString -> IO ([(ByteString, ByteString)], Maybe Integer, [ByteString]) -> Redis (Maybe [(ByteString, ByteString)])
+ Database.Redis.Pile: pile :: (MonadIO ma, ma ~ Redis) => ByteString -> ByteString -> Maybe (ByteString, ByteString) -> Maybe ByteString -> (forall mb. MonadIO mb => mb ([(ByteString, ByteString)], Maybe Integer, [ByteString])) -> ma (Maybe [(ByteString, ByteString)])

Files

hedis-pile.cabal view
@@ -1,5 +1,5 @@ name:           hedis-pile
-version:        0.3.1
+version:        0.4.0
 cabal-version:  >= 1.8
 build-type:     Simple
 stability:      Experimental
src/Database/Redis/Pile.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE OverloadedStrings #-} 
+{-# LANGUAGE OverloadedStrings, RankNTypes, TypeFamilies #-} 
 
 -- | Solution for caching mandatory data with Redis.
 --   
@@ -15,7 +15,7 @@ 
 import qualified Data.ByteString as B
 
-import Control.Monad.IO.Class (liftIO)
+import Control.Monad.IO.Class (MonadIO)
 import Control.Monad (void)
 
 import qualified Database.Redis as R
@@ -61,7 +61,7 @@ --   * @O(1)@ If expect matches.
 --
 --   * @O(2)@ If payload field provided
-pile :: 
+pile :: forall ma . (MonadIO ma, ma ~ R.Redis) => 
        B.ByteString
             -- ^ Prefix for key and tags.
     -> B.ByteString        
@@ -73,12 +73,12 @@             --   request data from the cache from @O(N)@ to @O(1)@.
             --   Regardless of setting this field, all data from computation
             --   will stored in cache.
-    -> IO ([(B.ByteString, B.ByteString)], 
+    -> (forall mb . MonadIO mb => mb ([(B.ByteString, B.ByteString)], 
            Maybe Integer, 
-           [B.ByteString])
+           [B.ByteString]))
             -- ^ Computation that returns data and 
             --   optional TTL and tags. All tags will be stored as @prefix:tag@.
-    -> R.Redis (Maybe [(B.ByteString, B.ByteString)])
+    -> ma (Maybe [(B.ByteString, B.ByteString)])
 pile p key (Just (ef, ev)) payload f = do
     e <- R.hget (p `B.append` ":" `B.append` key) ef
     case e of
@@ -105,7 +105,7 @@     
     withPrefix = p `B.append` ":" `B.append` key
     runF = do
-        (r, ke, t) <- liftIO f
+        (r, ke, t) <- f
         void $ R.hmset withPrefix r
         setExpire ke
         RT.markTags [withPrefix] p t