keyed-vals-redis 0.2.3.5 → 0.2.3.6
raw patch · 3 files changed
+38/−30 lines, 3 files
Files
- ChangeLog.md +6/−0
- keyed-vals-redis.cabal +2/−2
- src/KeyedVals/Handle/Redis/Internal.hs +30/−28
ChangeLog.md view
@@ -2,6 +2,12 @@ `keyed-vals-redis` uses [PVP Versioning][1]. +## 0.2.3.6 -- 2026-06-26++Changed++* Fix broken compile due to dependency change in v0.2.3.5+ ## 0.2.3.5 -- 2026-06-20 Changed
keyed-vals-redis.cabal view
@@ -1,11 +1,11 @@ cabal-version: 3.0 name: keyed-vals-redis-version: 0.2.3.5+version: 0.2.3.6 license: BSD-3-Clause license-file: LICENSE maintainer: adetokunbo@emio.la author: Tim Emiola-tested-with: GHC ==8.10.7 || ==9.0.2 || ==9.2.4 || ==9.4.1+tested-with: GHC ==9.6.6 || ==9.0.2 || ==9.10.1 homepage: https://github.com/adetokunbo/keyed-vals#readme bug-reports: https://github.com/adetokunbo/keyed-vals/issues synopsis:
src/KeyedVals/Handle/Redis/Internal.hs view
@@ -79,7 +79,7 @@ -- | Create a 'Handle'.-fromConnectInfo :: MonadUnliftIO m => ConnectInfo -> m (Handle m)+fromConnectInfo :: (MonadUnliftIO m) => ConnectInfo -> m (Handle m) fromConnectInfo connectInfo = do conn <- liftIO $ checkedConnect connectInfo pure $@@ -99,12 +99,12 @@ } -hClose' :: MonadUnliftIO m => Connection -> m ()+hClose' :: (MonadUnliftIO m) => Connection -> m () hClose' = liftIO . disconnect hLoadVal' ::- MonadUnliftIO m =>+ (MonadUnliftIO m) => Connection -> Key -> m (Either HandleErr (Maybe Val))@@ -112,7 +112,7 @@ hSaveVal' ::- MonadUnliftIO m =>+ (MonadUnliftIO m) => Connection -> Key -> Val ->@@ -121,7 +121,7 @@ hLoadFrom' ::- MonadUnliftIO m =>+ (MonadUnliftIO m) => Connection -> Key -> Key ->@@ -130,7 +130,7 @@ hLoadKVs' ::- MonadUnliftIO m =>+ (MonadUnliftIO m) => Connection -> Key -> m (Either HandleErr ValsByKey)@@ -138,24 +138,23 @@ hLoadSlice' ::- MonadUnliftIO m =>+ (MonadUnliftIO m) => Connection -> Key -> Selection -> m (Either HandleErr ValsByKey) hLoadSlice' conn key m@(Match _) = selectKeysThen hLoadSlice' conn key m-hLoadSlice' conn key (AllOf dictKeys') = do- let dictKeys = NonEmpty.toList dictKeys'+hLoadSlice' conn key (AllOf dictKeys) = do doFetch conn (hmget key dictKeys) >>= \case Left err -> pure $ Left err Right fetched -> do- let pairedMaybes = zip dictKeys fetched+ let pairedMaybes = zip (NonEmpty.toList dictKeys) fetched mbOf (x, mbY) = mbY >>= \y -> Just (x, y) pure $ Right $ Map.fromList $ mapMaybe mbOf pairedMaybes hCountKVs' ::- MonadUnliftIO m =>+ (MonadUnliftIO m) => Connection -> Key -> m (Either HandleErr Natural)@@ -163,17 +162,17 @@ hSaveTo' ::- MonadUnliftIO m =>+ (MonadUnliftIO m) => Connection -> Key -> Key -> Val -> m (Either HandleErr ())-hSaveTo' conn key dictKey value = doStore' conn $ hset key dictKey value+hSaveTo' conn key dictKey value = doStore' conn $ hset key (NonEmpty.singleton (dictKey, value)) hSaveKVs' ::- MonadUnliftIO m =>+ (MonadUnliftIO m) => Connection -> Key -> ValsByKey ->@@ -184,20 +183,23 @@ hUpdateKVs' ::- MonadUnliftIO m =>+ (MonadUnliftIO m) => Connection -> Key -> ValsByKey -> m (Either HandleErr ())-hUpdateKVs' conn key dict = doStore' conn $ hmset key $ Map.toList dict+hUpdateKVs' conn key dict =+ case NonEmpty.nonEmpty $ Map.toList dict of+ Just x -> doStore' conn $ hmset key x+ Nothing -> pure $ Right () hDeleteSelected' ::- MonadUnliftIO m =>+ (MonadUnliftIO m) => Connection -> Selection -> m (Either HandleErr ())-hDeleteSelected' conn (AllOf ks) = doStore' conn $ del $ NonEmpty.toList ks+hDeleteSelected' conn (AllOf ks) = doStore' conn $ del ks hDeleteSelected' conn (Match g) = do doFetch conn (keys $ globPattern g) >>= \case Left e -> pure $ Left e@@ -206,12 +208,12 @@ hDeleteSelectedKVs' ::- MonadUnliftIO m =>+ (MonadUnliftIO m) => Connection -> Key -> Selection -> m (Either HandleErr ())-hDeleteSelectedKVs' conn key (AllOf dictKeys) = doStore' conn $ hdel key $ NonEmpty.toList dictKeys+hDeleteSelectedKVs' conn key (AllOf dictKeys) = doStore' conn $ hdel key dictKeys hDeleteSelectedKVs' conn key m@(Match _) = selectKeysThen hDeleteSelectedKVs' conn key m @@ -223,11 +225,11 @@ Selection -> m (Either HandleErr b) selectKeysThen f conn key selection = do- (doFetch conn $ hkeys key) >>= \case+ doFetch conn (hkeys key) >>= \case Left e -> pure $ Left e Right [] -> pure $ Right mempty Right xs -> do- case (filter (\k -> k `isIn` selection) xs) of+ case filter (`isIn` selection) xs of [] -> pure $ Right mempty (k : ks) -> f conn key $ AllOf (k :| ks) @@ -243,14 +245,14 @@ doStore ::- MonadIO m =>+ (MonadIO m) => Connection -> Redis (Either Reply Status) -> m (Either HandleErr ()) doStore conn action = liftIO $ leftErr $ runRedis conn action -leftErr :: Monad m => m (Either Reply Status) -> m (Either HandleErr ())+leftErr :: (Monad m) => m (Either Reply Status) -> m (Either HandleErr ()) leftErr x = x >>= \case (Left l) -> pure $ Left $ toHandleErr l@@ -260,14 +262,14 @@ doStore' ::- MonadIO m =>+ (MonadIO m) => Connection -> Redis (Either Reply a) -> m (Either HandleErr ()) doStore' conn action = liftIO $ leftErr'' $ runRedis conn action -leftErr'' :: Monad m => m (Either Reply a) -> m (Either HandleErr ())+leftErr'' :: (Monad m) => m (Either Reply a) -> m (Either HandleErr ()) leftErr'' x = x >>= \case (Left l) -> pure $ Left $ toHandleErr l@@ -275,12 +277,12 @@ doFetch ::- MonadUnliftIO m =>+ (MonadUnliftIO m) => Connection -> Redis (Either Reply a) -> m (Either HandleErr a) doFetch conn = liftIO . leftErr' . runRedis conn -leftErr' :: Monad m => m (Either Reply a) -> m (Either HandleErr a)+leftErr' :: (Monad m) => m (Either Reply a) -> m (Either HandleErr a) leftErr' = (<&> either (Left . toHandleErr) Right)