summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillLangstroth <>2010-11-25 00:58:04 (GMT)
committerLuite Stegeman <luite@luite.com>2010-11-25 00:58:04 (GMT)
commitd2e8665d1c6ec7f181cf9a31c844ce9d094e4437 (patch)
treed588cf8a58d496ddad32344b201e2b56ec1f8625
parent2e0d61f4cc7e413d597949e7fe5bb616611da8d0 (diff)
version 0.1.00.1.0
-rw-r--r--CONTRIBUTORS6
-rw-r--r--README.md7
-rw-r--r--redis-hs.cabal26
-rw-r--r--src/Database/Redis.hs8
-rw-r--r--src/Database/Redis/General.hs126
-rw-r--r--src/Database/Redis/Hash.hs145
-rw-r--r--src/Database/Redis/Internal.hs53
-rw-r--r--src/Database/Redis/List.hs96
-rw-r--r--src/Database/Redis/Set.hs118
-rw-r--r--src/Database/Redis/SortedSet.hs178
-rw-r--r--src/Database/Redis/String.hs146
-rw-r--r--test/redis-tests.cabal2
-rw-r--r--test/suite/Database/Redis/General/Tests.hs9
-rw-r--r--test/suite/Database/Redis/List/Tests.hs6
-rw-r--r--test/suite/Database/Redis/Set/Tests.hs12
15 files changed, 788 insertions, 150 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
deleted file mode 100644
index ab425f3..0000000
--- a/CONTRIBUTORS
+++ /dev/null
@@ -1,6 +0,0 @@
-Author:
- Will Langstroth
-
-Based on code by:
- Alexander Bogdanov
- Anders Conbere
diff --git a/README.md b/README.md
index b402e3f..623cefa 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# redis-link
+# redis-hs
A simple link to Redis in Haskell, emphasizing ease of use, readability of
code, documentation and test coverage.
@@ -19,3 +19,8 @@ To test it out, try the following:
If you need to see the details of the response, replace `unwrapReply` with
`show`.
+
+## Acknowledgements
+
+Much of the code in this library is inspired by the work of Anders Conbere and
+Alexander Bogdanov (author of the redis library on Hackage).
diff --git a/redis-hs.cabal b/redis-hs.cabal
index 41643a1..6beffab 100644
--- a/redis-hs.cabal
+++ b/redis-hs.cabal
@@ -1,21 +1,14 @@
name: redis-hs
-version: 0.0.13
+version: 0.1.0
author: Will Langstroth <will@langstroth.com>
maintainer: Will Langstroth <will@langstroth.com>
license: MIT
license-file: LICENSE
-homepage: http://github.com/wlangstroth/redis-hs
+homepage: http://ohloh.net/p/redis-hs
synopsis: A simple Redis library for Haskell
description:
- This package provides access to Redis stores using the Data.ByteString.UTF8
- ByteString, for consistent handling of UTF8 encoding. It is a developer pre-
- release, so it lacks many of the features of the existing `redis` package
- (including a monad wrapper, custom state management, and custom concurrency
- management) but for ordinary tasks, this library makes using Redis very
- straightforward.
- .
- The feature set is incomplete, with a full command set, test coverage, and
- documentation planned for version 0.1.
+ This package provides access to Redis stores using Data.ByteString.UTF8 for
+ consistent handling of UTF8 encoding. The function set is almost complete.
category: Database
build-type: Simple
@@ -24,7 +17,6 @@ cabal-version: >= 1.6
extra-source-files:
haddock.sh,
LICENSE,
- CONTRIBUTORS,
README.md,
test/redis-tests.cabal,
test/suite/TestSuite.hs,
@@ -39,22 +31,26 @@ library
exposed-modules:
Database.Redis,
- Database.Redis.Internal,
Database.Redis.Connection,
Database.Redis.General,
Database.Redis.String,
Database.Redis.List,
Database.Redis.Set,
+ Database.Redis.SortedSet,
+ Database.Redis.Hash,
Database.Redis.Transaction
+ other-modules:
+ Database.Redis.Internal
build-depends:
base == 4.*,
bytestring >= 0.9,
--- mtl == 2.*,
network == 2.2.1.*,
utf8-string >= 0.3.5
- ghc-options: -Wall -fwarn-tabs
+ ghc-options: -Wall
+
+ ghc-prof-options: -prof -auto-all
source-repository head
type: git
diff --git a/src/Database/Redis.hs b/src/Database/Redis.hs
index dc78cf3..6a93458 100644
--- a/src/Database/Redis.hs
+++ b/src/Database/Redis.hs
@@ -4,9 +4,9 @@ module Database.Redis
, module Database.Redis.String
, module Database.Redis.List
, module Database.Redis.Set
+ , module Database.Redis.SortedSet
+ , module Database.Redis.Hash
, module Database.Redis.Transaction
--- , module Database.Redis.SortedSet
--- , module Database.Redis.Hash
) where
import Database.Redis.Connection
@@ -14,6 +14,6 @@ import Database.Redis.General
import Database.Redis.String
import Database.Redis.List
import Database.Redis.Set
+import Database.Redis.SortedSet
+import Database.Redis.Hash
import Database.Redis.Transaction
--- import Database.Redis.SortedSet
--- import Database.Redis.Hash
diff --git a/src/Database/Redis/General.hs b/src/Database/Redis/General.hs
index 3d4f84d..9af3a6a 100644
--- a/src/Database/Redis/General.hs
+++ b/src/Database/Redis/General.hs
@@ -6,10 +6,19 @@ module Database.Redis.General
, keys, keysB
, keyRandom
, keyRename
+ , keyRenameNX
+ , databaseSize
+ , keyTimeToLive
+ , keyExpire
+ , keyExpireAt
+ , keyPersist
+ , keyMove
+ , flushDB
+ , flushAll
, select
, toUTF8
, ping
- , unwrapReply, unwrapReplyB
+ , unwrapReply
) where
import Data.Maybe
@@ -48,7 +57,7 @@ keyDelete h ks = request h $ map toUTF8 ("DEL":ks)
keyDeleteB :: Handle
-> [ByteString] -- ^ keys to delete
-> IO (Maybe RedisReply)
-keyDeleteB h ks = request h ((toUTF8 "DEL"):ks)
+keyDeleteB h ks = request h $ (toUTF8 "DEL"):ks
------------------------------------------------------------------------------
@@ -91,63 +100,118 @@ keyRandom :: Handle
keyRandom h = request h [toUTF8 "RANDOMKEY"]
--- | Calls @RENAME@ (<http://code.google.com/p/redis/wiki/RenameCommand>)
+------------------------------------------------------------------------------
+-- | Calls @RENAME@ (<http://code.google.com/p/redis/wiki/RenameCommand>) with
+-- 'String' arguments.
keyRename :: Handle
-> String -- ^ old key name
-> String -- ^ new key name
-> IO (Maybe RedisReply)
keyRename h old new = request h $ map toUTF8 ["RENAME", old, new]
--- RENAMENX
--- DBSIZE
--- EXPIRE
--- PERSIST
+
+------------------------------------------------------------------------------
+-- | Calls @RENAMENX@ (<http://code.google.com/p/redis/wiki/RenamenxCommand>)
+-- with 'String' arguments.
+keyRenameNX :: Handle
+ -> String -- ^ old key name
+ -> String -- ^ new key name
+ -> IO (Maybe RedisReply)
+keyRenameNX h old new = request h $ map toUTF8 ["RENAMENX", old, new]
+
+
+------------------------------------------------------------------------------
+-- | DBSIZE
+databaseSize :: Handle
+ -> IO (Maybe RedisReply)
+databaseSize h = request h [toUTF8 "SELECT"]
+
+
+------------------------------------------------------------------------------
+-- | EXPIRE
+keyExpire :: Handle
+ -> String -- ^ key
+ -> Int -- ^ number of seconds intil expiry
+ -> IO (Maybe RedisReply)
+keyExpire h key i = request h $ map toUTF8 ["EXPIRE", key, show i]
+
+
+------------------------------------------------------------------------------
+-- | EXPIREAT
+keyExpireAt :: Handle
+ -> String -- ^ key
+ -> Int -- ^ unix time of expiry
+ -> IO (Maybe RedisReply)
+keyExpireAt h key i = request h $ map toUTF8 ["EXPIREAT", key, show i]
+
+
+------------------------------------------------------------------------------
+-- | PERSIST
+keyPersist :: Handle
+ -> String -- ^ key
+ -> IO (Maybe RedisReply)
+keyPersist h key = request h $ map toUTF8 ["PERSIST", key]
+
+
+------------------------------------------------------------------------------
-- TTL
+keyTimeToLive :: Handle
+ -> String -- ^ key
+ -> IO (Maybe RedisReply)
+keyTimeToLive h key = request h $ map toUTF8 ["PERSIST", key]
------------------------------------------------------------------------------
--- | SELECT
+-- | Calls @SELECT@ (<http://code.google.com/p/redis/wiki/SelectCommand>)
+-- with an 'Int' argument
select :: Handle
-> Int -- ^ the database to switch to
-> IO (Maybe RedisReply)
select h i = request h $ map toUTF8 ["SELECT", show i]
+------------------------------------------------------------------------------
-- MOVE
--- FLUSHDB
--- FLUSHALL
+keyMove :: Handle
+ -> String -- ^ key
+ -> Int -- ^ the database to switch to
+ -> IO (Maybe RedisReply)
+keyMove h key i = request h $ map toUTF8 ["SELECT", key, show i]
+
------------------------------------------------------------------------------
+-- | FLUSHDB
+flushDB :: Handle
+ -> IO (Maybe RedisReply)
+flushDB h = request h [toUTF8 "FLUSHDB"]
+
+
+-- | FLUSHALL
+flushAll :: Handle
+ -> IO (Maybe RedisReply)
+flushAll h = request h [toUTF8 "FLUSHALL"]
+
+
+------------------------------------------------------------------------------
+-- | The PING command should return PONG
ping :: Handle
-> IO (Maybe RedisReply)
ping h = request h $ map toUTF8 ["PING"]
------------------------------------------------------------------------------
-unwrapReply :: Maybe RedisReply -> String
+-- | Placeholder for a better-designed function
+unwrapReply :: Maybe RedisReply -> [String]
unwrapReply reply =
case reply of
- Just (RedisBulk [Just (RedisSingle x)]) -> fromUTF8 x
- Just (RedisSingle x) -> fromUTF8 x
- Just (RedisError x) -> fromUTF8 x
- Just (RedisInteger x) -> show x
- Nothing -> "Nada"
- _ -> "Not yet Supported"
-
-
-------------------------------------------------------------------------------
--- | N.B. This only goes down one level right now
-unwrapReplyB :: Maybe RedisReply -> [ByteString]
-unwrapReplyB reply =
- case reply of
- Just (RedisSingle x) -> [x]
- Just (RedisError x) -> [x]
- Just (RedisInteger x) -> [toUTF8 $ show x]
- Just (RedisBulk x) -> catMaybes $ map bulks x
- Nothing -> [toUTF8 "Nada"]
+ Just (RedisSingle x) -> map fromUTF8 [x]
+ Just (RedisError x) -> map fromUTF8 [x]
+ Just (RedisInteger x) -> [show x]
+ Just (RedisBulk x) -> map fromUTF8 $ catMaybes $ map bulks x
+ Nothing -> ["Nada"]
where
bulks rs = case rs of
Just (RedisBulk [Just (RedisSingle x)]) -> Just x
- Nothing -> Nothing
- _ -> Nothing
+ Nothing -> Nothing
+
diff --git a/src/Database/Redis/Hash.hs b/src/Database/Redis/Hash.hs
new file mode 100644
index 0000000..a0a35c0
--- /dev/null
+++ b/src/Database/Redis/Hash.hs
@@ -0,0 +1,145 @@
+module Database.Redis.Hash
+ ( hashSet, hashSetB
+ , hashGet, hashGetB
+ , hashMultiGet
+ , hashMultiSet
+ , hashIncrementBy
+ , hashExists
+ , hashDelete
+ , hashLength
+ , hashKeys
+ , hashValues
+ , hashGetAll
+ ) where
+
+
+import System.IO
+
+import Database.Redis.Internal
+
+
+------------------------------------------------------------------------------
+-- | Calls @HSET@ with 'String' arguments
+hashSet :: Handle
+ -> String -- ^ key
+ -> String -- ^ field
+ -> String -- ^ value
+ -> IO (Maybe RedisReply)
+hashSet h key field value = request h $ map toUTF8 ["HSET", key, field, value]
+
+
+------------------------------------------------------------------------------
+-- | Calls @HSET@ with 'ByteString' arguments
+hashSetB :: Handle
+ -> ByteString -- ^ key
+ -> ByteString -- ^ field
+ -> ByteString -- ^ value
+ -> IO (Maybe RedisReply)
+hashSetB h key field value = request h [toUTF8 "HSET", key, field, value]
+
+
+------------------------------------------------------------------------------
+-- | Calls @HGET@ with 'ByteString' arguments
+hashGet :: Handle
+ -> String -- ^ key
+ -> String -- ^ field
+ -> IO (Maybe RedisReply)
+hashGet h key field = request h $ map toUTF8 ["HSET", key, field]
+
+
+-- | Calls @HGET@ with 'ByteString' arguments
+hashGetB :: Handle
+ -> ByteString -- ^ key
+ -> ByteString -- ^ field
+ -> IO (Maybe RedisReply)
+hashGetB h key field = request h [toUTF8 "HSET", key, field]
+
+
+------------------------------------------------------------------------------
+-- | Calls @HMGET@ <http://code.google.com/p/redis/wiki/HmgetCommand> with a
+-- list of 'String's
+hashMultiGet :: Handle
+ -> String -- ^ key
+ -> [String] -- ^ fields
+ -> IO (Maybe RedisReply)
+hashMultiGet h k hs = request h $ map toUTF8 $ "HMGET":k:hs
+
+
+------------------------------------------------------------------------------
+-- | Calls @HMSET@ <http://code.google.com/p/redis/wiki/HmsetCommand> with a
+-- list of tuples (key, value)
+hashMultiSet :: Handle
+ -> String -- ^ key
+ -> [(String, String)] -- ^ key/value pairs to set
+ -> IO (Maybe RedisReply)
+hashMultiSet h k kvs = request h $ map toUTF8 $ "HMSET":k:(pairsToList kvs)
+
+
+------------------------------------------------------------------------------
+-- | Calls @HINCRBY@ with 'String' and 'Int' arguments
+hashIncrementBy :: Handle
+ -> String -- ^ key
+ -> String -- ^ field
+ -> Int -- ^ field
+ -> IO (Maybe RedisReply)
+hashIncrementBy h key field i =
+ request h $ map toUTF8 ["HINCRBY", key, field, show i]
+
+
+------------------------------------------------------------------------------
+-- | Calls @HEXISTS@ (<http://code.google.com/p/redis/wiki/HexistsCommand>)
+-- with 'String' arguments
+hashExists :: Handle
+ -> String -- ^ key
+ -> String -- ^ field
+ -> IO (Maybe RedisReply)
+hashExists h key field = request h $ map toUTF8 ["HEXISTS", key, field]
+
+
+------------------------------------------------------------------------------
+-- | Calls @HDEL@ (<http://code.google.com/p/redis/wiki/HdelCommand>)
+-- with 'String' arguments
+hashDelete :: Handle
+ -> String -- ^ key
+ -> String -- ^ field
+ -> IO (Maybe RedisReply)
+hashDelete h key field = request h $ map toUTF8 ["HDEL", key, field]
+
+
+------------------------------------------------------------------------------
+-- | Calls @HLEN@ (<http://code.google.com/p/redis/wiki/HlenCommand>)
+-- with 'String' arguments
+hashLength :: Handle
+ -> String -- ^ key
+ -> String -- ^ field
+ -> IO (Maybe RedisReply)
+hashLength h key field = request h $ map toUTF8 ["HLEN", key, field]
+
+
+------------------------------------------------------------------------------
+-- | Calls @HKEYS@ (<http://code.google.com/p/redis/wiki/HkeysCommand>)
+-- with a 'String' argument. N.B. despite its name, it returns fields.
+hashKeys :: Handle
+ -> String -- ^ key
+ -> IO (Maybe RedisReply)
+hashKeys h k = request h $ map toUTF8 ["HKEYS", k]
+
+
+------------------------------------------------------------------------------
+-- | Calls @HVALS@ (<http://code.google.com/p/redis/wiki/HvalsCommand>)
+-- with a 'String' argument.
+hashValues :: Handle
+ -> String -- ^ key
+ -> IO (Maybe RedisReply)
+hashValues h k = request h $ map toUTF8 ["HVALS", k]
+
+
+------------------------------------------------------------------------------
+-- | Calls @HGETALL@ (<http://code.google.com/p/redis/wiki/HgetallCommand>)
+-- with a 'String' argument.
+hashGetAll :: Handle
+ -> String -- ^ key
+ -> IO (Maybe RedisReply)
+hashGetAll h k = request h $ map toUTF8 ["HGETALL", k]
+
+
diff --git a/src/Database/Redis/Internal.hs b/src/Database/Redis/Internal.hs
index 2b61db2..fd40739 100644
--- a/src/Database/Redis/Internal.hs
+++ b/src/Database/Redis/Internal.hs
@@ -1,7 +1,7 @@
-{-
--- | This module processes requests and replies, and contains some utility
--- functions
--}
+-- | This module processes requests and replies, and contains some utility
+-- functions. The methods by which requests are processed are stylistically
+-- modified versions of those found in Alexander Bogdanov's @redis@ package,
+-- which can be found on hackage at <http://hackage.haskell.org/package/redis>
module Database.Redis.Internal
( RedisReply(..)
@@ -10,11 +10,10 @@ module Database.Redis.Internal
, crlf
, toUTF8
, fromUTF8
+ , pairsToList
) where
--- import Data.Maybe
-
import Data.ByteString.UTF8 (ByteString)
import qualified Data.ByteString.UTF8 as U
import qualified Data.ByteString as B
@@ -30,11 +29,11 @@ data RedisReply = RedisSingle ByteString
------------------------------------------------------------------------------
+-- | Sends the request
send :: Handle
-> ByteString -- ^ the request
-> IO (Maybe RedisReply)
-send h req = B.hPut h req >> B.hPut h (toUTF8 crlf) >>
- hFlush h >> processReply h
+send h req = B.hPut h req >> B.hPut h (toUTF8 crlf) >> processReply h
------------------------------------------------------------------------------
@@ -56,7 +55,8 @@ request h commandList = send h $
, toUTF8 crlf
, c
, toUTF8 crlf
- ]) (sendCommands cs)
+ ])
+ (sendCommands cs)
bulkLength cmds = toUTF8 $ '*' : (show $ length cmds)
@@ -64,12 +64,14 @@ request h commandList = send h $
------------------------------------------------------------------------------
+-- | The main processing function. See the guide to Redis responses here:
+-- <http://code.google.com/p/redis/wiki/ProtocolSpecification>
processReply :: Handle -> IO (Maybe RedisReply)
processReply h = do
reply <- fmap trim $ B.hGetLine h
case U.uncons reply of
- Just ('+', rest) -> return $ Just (RedisSingle rest)
- Just ('-', rest) -> return $ Just (RedisError rest)
+ Just ('+', rest) -> singleReply rest
+ Just ('-', rest) -> errorReply rest
Just (':', rest) -> integerReply rest
Just ('$', rest) -> bulkReply rest
Just ('*', rest) -> multiBulkReply rest
@@ -78,49 +80,64 @@ processReply h = do
where
trim = B.takeWhile (\c -> c /= 13 && c /= 10)
+ singleReply b = return $ Just $ RedisSingle b
+
+ errorReply b = return $ Just $ RedisError b
+
integerReply b = return $ Just $ RedisInteger $ toInt b
bulkReply b = do
body <- bulkBody $ toInt b
return $ case body of
Just x -> Just (RedisBulk [Just $ RedisSingle x])
- _ -> Nothing
+ _ -> Nothing
bulkBody (-1) = return $ Nothing
bulkBody size = do
- body <- B.hGet h (size + 2)
+ body <- B.hGet h (size + 2) -- i.e. including crlf
let reply = B.take size body
- return $ Just reply
+ return $! Just reply
multiBulkReply b = do
bulks <- multiBulkReplies $ toInt b
- return $ Just $ RedisBulk bulks
+ return $! Just $ RedisBulk bulks
- multiBulkReplies (-1) = return $ [Nothing]
- multiBulkReplies 0 = return $ [Nothing]
+ multiBulkReplies (-1) = return $ []
+ multiBulkReplies 0 = return $ []
multiBulkReplies n = do
this <- processReply h
rest <- multiBulkReplies (n - 1)
- return $ (this : rest)
+ return $! this : rest
------------------------------------------------------------------------------
+-- | Shorthand for \"\r\n\". Redis uses CRLF.
crlf :: String
crlf = "\r\n"
------------------------------------------------------------------------------
+-- | Not strictly necessary, but adds readability
toUTF8 :: String -> ByteString
toUTF8 = U.fromString
------------------------------------------------------------------------------
+-- | Not strictly necessary, but adds readability
fromUTF8 :: ByteString -> String
fromUTF8 = U.toString
------------------------------------------------------------------------------
+-- | Converts a UTF8 ByteString into its Int value
toInt :: ByteString -> Int
toInt b = read (U.toString b) :: Int
+------------------------------------------------------------------------------
+-- | Turns a list of pair tuples into a list
+pairsToList :: [(a,a)] -> [a]
+pairsToList [] = []
+pairsToList ((a,b):rest) = a : b : pairsToList rest
+
+
diff --git a/src/Database/Redis/List.hs b/src/Database/Redis/List.hs
index 374141c..b612db4 100644
--- a/src/Database/Redis/List.hs
+++ b/src/Database/Redis/List.hs
@@ -11,6 +11,13 @@ module Database.Redis.List
, listRange, listRangeB
, listIndex, listIndexB
, listRemove, listRemoveB
+ , listTrim
+ , listSet
+ , listHeadPop
+ , listTailPop
+ , listBlockHeadPop
+ , listBlockTailPop
+ , listRPopLPush
) where
@@ -20,7 +27,7 @@ import Database.Redis.Internal
------------------------------------------------------------------------------
--- | Calls `RPUSH` with 'String' arguments
+-- | Calls @RPUSH@ with 'String' arguments
listRightPush :: Handle
-> String -- ^ key
-> String -- ^ value
@@ -28,7 +35,7 @@ listRightPush :: Handle
listRightPush h key value = request h $ map toUTF8 ["RPUSH", key, value]
--- | Calls `RPUSH` with 'ByteString' arguments
+-- | Calls @RPUSH@ with 'ByteString' arguments
listRightPushB :: Handle
-> ByteString -- ^ key
-> ByteString -- ^ value
@@ -37,7 +44,7 @@ listRightPushB h key value = request h [toUTF8 "RPUSH", key, value]
------------------------------------------------------------------------------
--- | Calls `LPUSH` with 'String' arguments
+-- | Calls @LPUSH@ with 'String' arguments
listLeftPush :: Handle
-> String -- ^ key
-> String -- ^ value
@@ -45,7 +52,7 @@ listLeftPush :: Handle
listLeftPush h key value = request h $ map toUTF8 ["LPUSH", key, value]
--- | Calls `LPUSH` with 'ByteString' arguments
+-- | Calls @LPUSH@ with 'ByteString' arguments
listLeftPushB :: Handle
-> ByteString -- ^ key
-> ByteString -- ^ value
@@ -54,14 +61,14 @@ listLeftPushB h key value = request h [toUTF8 "LPUSH", key, value]
------------------------------------------------------------------------------
--- | Calls `LLEN` with a 'String' argument
+-- | Calls @LLEN@ with a 'String' argument
listLength :: Handle
-> String -- ^ key
-> IO (Maybe RedisReply)
listLength h key = request h $ map toUTF8 ["LLEN", key]
--- | Calls `LLEN` with a 'ByteString' argument
+-- | Calls @LLEN@ with a 'ByteString' argument
listLengthB :: Handle
-> ByteString -- ^ key
-> IO (Maybe RedisReply)
@@ -69,7 +76,7 @@ listLengthB h key = request h [toUTF8 "LLEN", key]
------------------------------------------------------------------------------
--- | Calls `LRANGE` with a 'String' argument
+-- | Calls @LRANGE@ with a 'String' argument
listRange :: Handle
-> String -- ^ key
-> Int -- ^ start
@@ -79,7 +86,7 @@ listRange h key start end =
request h $ map toUTF8 ["LRANGE", key, show start, show end]
--- | Calls `LRANGE` with a 'ByteString' argument
+-- | Calls @LRANGE@ with a 'ByteString' argument
listRangeB :: Handle
-> ByteString -- ^ key
-> Int -- ^ start
@@ -90,11 +97,18 @@ listRangeB h key start end =
------------------------------------------------------------------------------
--- LTRIM
+-- | LTRIM
+listTrim :: Handle
+ -> String -- ^ key
+ -> Int -- ^ start
+ -> Int -- ^ end
+ -> IO (Maybe RedisReply)
+listTrim h key start end =
+ request h $ map toUTF8 ["LTRIM", key, show start, show end]
------------------------------------------------------------------------------
--- | Calls `LINDEX` with 'String' and 'Int' arguments
+-- | Calls @LINDEX@ with 'String' and 'Int' arguments
listIndex :: Handle
-> String -- ^ key
-> Int -- ^ index
@@ -103,7 +117,7 @@ listIndex h key index =
request h $ map toUTF8 ["LINDEX", key, show index]
--- | Calls `LINDEX` with 'ByteString' and 'Int' arguments
+-- | Calls @LINDEX@ with 'ByteString' and 'Int' arguments
listIndexB :: Handle
-> ByteString -- ^ key
-> Int -- ^ index
@@ -112,12 +126,19 @@ listIndexB h key index =
request h [toUTF8 "LINDEX", key, toUTF8 $ show index]
+------------------------------------------------------------------------------
-- LSET
--- LREM
+listSet :: Handle
+ -> String -- ^ key
+ -> Int -- ^ index
+ -> String -- ^ value
+ -> IO (Maybe RedisReply)
+listSet h key index value =
+ request h $ map toUTF8 ["LSET", key, show index, value]
------------------------------------------------------------------------------
--- | Calls `LREM` with 'String' and 'Int' arguments. This command deletes
+-- | Calls @LREM@ with 'String' and 'Int' arguments. This command deletes
-- values matching the @value@ parameter. A negative 'Int' argument deletes
-- starting at the tail and moving towards the head (or from right to left,
-- after the push commands). A positive argument deletes from left to right.
@@ -132,7 +153,7 @@ listRemove h key num value =
request h $ map toUTF8 ["LREM", key, show num, value]
--- | Calls `LREM` with 'ByteString' and 'Int' arguments.
+-- | Calls @LREM@ with 'ByteString' and 'Int' arguments.
listRemoveB :: Handle
-> ByteString -- ^ key
-> Int -- ^ the number of items to delete (sign is direction)
@@ -142,8 +163,45 @@ listRemoveB h key num value =
request h [toUTF8 "LREM", key, toUTF8 $ show num, value]
--- LPOP
--- RPOP
--- BLPOP
--- BRPOP
--- RPOPLPUSH
+------------------------------------------------------------------------------
+-- | LPOP
+listHeadPop :: Handle
+ -> String -- ^ key
+ -> IO (Maybe RedisReply)
+listHeadPop h key =
+ request h $ map toUTF8 ["LPOP", key]
+
+
+-- | RPOP
+listTailPop :: Handle
+ -> String -- ^ key
+ -> IO (Maybe RedisReply)
+listTailPop h key =
+ request h $ map toUTF8 ["RPOP", key]
+
+
+-- | BLPOP
+listBlockHeadPop :: Handle
+ -> String -- ^ key
+ -> IO (Maybe RedisReply)
+listBlockHeadPop h key =
+ request h $ map toUTF8 ["BLPOP", key]
+
+
+-- | BRPOP
+listBlockTailPop :: Handle
+ -> String -- ^ key
+ -> IO (Maybe RedisReply)
+listBlockTailPop h key =
+ request h $ map toUTF8 ["BRPOP", key]
+
+
+-- | RPOPLPUSH
+listRPopLPush :: Handle
+ -> String -- ^ source key
+ -> String -- ^ destination key
+ -> IO (Maybe RedisReply)
+listRPopLPush h source destination =
+ request h $ map toUTF8 ["RPOPLPUSH", source, destination]
+
+
diff --git a/src/Database/Redis/Set.hs b/src/Database/Redis/Set.hs
index f5e1d99..5e02dac 100644
--- a/src/Database/Redis/Set.hs
+++ b/src/Database/Redis/Set.hs
@@ -1,14 +1,18 @@
module Database.Redis.Set
- ( setAdd
- , setAddB
- , setRemove
- , setRemoveB
- , setContains
- , setContainsB
- , setMembers
- , setMembersB
- , setRandMember
- , setRandMemberB
+ ( setAdd, setAddB
+ , setRemove, setRemoveB
+ , setPop
+ , setMove
+ , setCardinality
+ , setIsMember, setIsMemberB
+ , setIntersect
+ , setIntersectStore
+ , setUnion
+ , setUnionStore
+ , setDiff
+ , setDiffStore
+ , setMembers, setMembersB
+ , setRandMember, setRandMemberB
) where
@@ -51,34 +55,98 @@ setRemoveB :: Handle
setRemoveB h key value = request h [toUTF8 "SREM", key, value]
--- SPOP
--- SMOVE
--- SCARD
+------------------------------------------------------------------------------
+-- | SPOP
+setPop :: Handle
+ -> String -- ^ key
+ -> IO (Maybe RedisReply)
+setPop h key = request h $ map toUTF8 ["SPOP", key]
+
+
+------------------------------------------------------------------------------
+-- | SMOVE
+setMove :: Handle
+ -> String -- ^ source key
+ -> String -- ^ destination key
+ -> String -- ^ member
+ -> IO (Maybe RedisReply)
+setMove h s d m = request h $ map toUTF8 ["SMOVE", s, d, m]
+
+
+------------------------------------------------------------------------------
+-- | SCARD
+setCardinality :: Handle
+ -> String -- ^ key
+ -> IO (Maybe RedisReply)
+setCardinality h key = request h $ map toUTF8 ["SCARD", key]
------------------------------------------------------------------------------
-- | SISMEMBER
-setContains :: Handle
+setIsMember :: Handle
-> String -- ^ key
-> String -- ^ value
-> IO (Maybe RedisReply)
-setContains h key value = request h $ map toUTF8 ["SISMEMBER", key, value]
+setIsMember h key value = request h $ map toUTF8 ["SISMEMBER", key, value]
-- | SISMEMBER
-setContainsB :: Handle
+setIsMemberB :: Handle
-> ByteString -- ^ key
-> ByteString -- ^ value
-> IO (Maybe RedisReply)
-setContainsB h key value = request h [toUTF8 "SISMEMBER", key, value]
+setIsMemberB h key value = request h [toUTF8 "SISMEMBER", key, value]
+
+
+------------------------------------------------------------------------------
+-- | SINTER
+setIntersect :: Handle
+ -> [String] -- ^ keys for sets to intersect
+ -> IO (Maybe RedisReply)
+setIntersect h keys = request h $ map toUTF8 $ "SINTER":keys
--- SINTER
--- SINTERSTORE
--- SUNION
--- SUNIONSTORE
--- SDIFF
--- SDIFFSTORE
+------------------------------------------------------------------------------
+-- | SINTERSTORE
+setIntersectStore :: Handle
+ -> String -- ^ destination key
+ -> [String] -- ^ keys for sets to intersect
+ -> IO (Maybe RedisReply)
+setIntersectStore h dest keys = request h $ map toUTF8 $ "SINTER":dest:keys
+
+
+------------------------------------------------------------------------------
+-- | SUNION
+setUnion :: Handle
+ -> [String] -- ^ set keys to union
+ -> IO (Maybe RedisReply)
+setUnion h keys = request h $ map toUTF8 $ "SUNION":keys
+
+
+------------------------------------------------------------------------------
+-- | SUNIONSTORE
+setUnionStore :: Handle
+ -> String -- ^ destination key
+ -> [String] -- ^ set keys to union
+ -> IO (Maybe RedisReply)
+setUnionStore h dest keys = request h $ map toUTF8 $ "SUNIONSTORE":dest:keys
+
+
+------------------------------------------------------------------------------
+-- | SDIFF
+setDiff :: Handle
+ -> [String] -- ^ keys for sets to union
+ -> IO (Maybe RedisReply)
+setDiff h keys = request h $ map toUTF8 $ "SDIFF":keys
+
+
+------------------------------------------------------------------------------
+-- | SDIFFSTORE
+setDiffStore :: Handle
+ -> String -- ^ destination key
+ -> [String] -- ^ keys for sets to diff
+ -> IO (Maybe RedisReply)
+setDiffStore h dest keys = request h $ map toUTF8 $ "SDIFFSTORE":dest:keys
------------------------------------------------------------------------------
@@ -101,13 +169,13 @@ setMembersB h key = request h [toUTF8 "SMEMBERS", key]
setRandMember :: Handle
-> String -- ^ key
-> IO (Maybe RedisReply)
-setRandMember h key = request h $ map toUTF8 ["SMEMBERS", key]
+setRandMember h key = request h $ map toUTF8 ["SRANDMEMBER", key]
-- | SRANDMEMBER
setRandMemberB :: Handle
-> ByteString -- ^ key
-> IO (Maybe RedisReply)
-setRandMemberB h key = request h [toUTF8 "SMEMBERS", key]
+setRandMemberB h key = request h [toUTF8 "SRANDMEMBER", key]
diff --git a/src/Database/Redis/SortedSet.hs b/src/Database/Redis/SortedSet.hs
new file mode 100644
index 0000000..a64d88d
--- /dev/null
+++ b/src/Database/Redis/SortedSet.hs
@@ -0,0 +1,178 @@
+module Database.Redis.SortedSet
+ ( zSetAdd, zSetAddB
+ , zSetRemove
+ , zSetIncrementBy
+ , zSetRank
+ , zSetReverseRank
+ , zSetRange
+ , zSetReverseRange
+ , zSetRangeByScore
+ , zSetCount
+ , zSetCardinality
+ , zSetScore
+ , zSetRemRangeByRank
+ , zSetRemRangeByScore
+ {-
+ , zSetIntersectStore
+ , zSetUnionStore
+ -}
+ ) where
+
+
+import System.IO
+
+import Database.Redis.Internal
+
+
+------------------------------------------------------------------------------
+-- | ZADD
+zSetAdd :: Handle
+ -> String -- ^ key
+ -> String -- ^ score, which can be a string float in Redis
+ -> String -- ^ value
+ -> IO (Maybe RedisReply)
+zSetAdd h k s m = request h $ map toUTF8 ["ZADD", k, s, m]
+
+
+-- | ZADD
+zSetAddB :: Handle
+ -> ByteString -- ^ key
+ -> ByteString -- ^ score, which can be a string float in Redis
+ -> ByteString -- ^ member
+ -> IO (Maybe RedisReply)
+zSetAddB h k s m = request h [toUTF8 "ZADD", k, s, m]
+
+
+------------------------------------------------------------------------------
+-- | ZREM
+zSetRemove :: Handle
+ -> String -- ^ key
+ -> IO (Maybe RedisReply)
+zSetRemove h k = request h $ map toUTF8 ["ZREM", k]
+
+
+------------------------------------------------------------------------------
+-- | ZINCRBY
+zSetIncrementBy :: Handle
+ -> String -- ^ key
+ -> Int -- ^ amount to increment
+ -> String -- ^ member
+ -> IO (Maybe RedisReply)
+zSetIncrementBy h k i m = request h $ map toUTF8 ["ZINCRBY", k, show i, m]
+
+
+------------------------------------------------------------------------------
+-- | ZRANK
+zSetRank :: Handle
+ -> String -- ^ key
+ -> String -- ^ member
+ -> IO (Maybe RedisReply)
+zSetRank h k m = request h $ map toUTF8 ["ZRANK", k, m]
+
+
+------------------------------------------------------------------------------
+-- | ZREVRANK
+zSetReverseRank :: Handle
+ -> String -- ^ key
+ -> String -- ^ member
+ -> IO (Maybe RedisReply)
+zSetReverseRank h k m = request h $ map toUTF8 ["ZREVRANK", k, m]
+
+
+------------------------------------------------------------------------------
+-- | ZRANGE (does not yet include WITHSCORES)
+zSetRange :: Handle
+ -> String -- ^ key
+ -> Int -- ^ start
+ -> Int -- ^ end
+ -> IO (Maybe RedisReply)
+zSetRange h k s e = request h $ map toUTF8 ["ZRANGE", k, show s, show e]
+
+
+
+------------------------------------------------------------------------------
+-- | ZREVRANGE (does not yet include WITHSCORES)
+zSetReverseRange :: Handle
+ -> String -- ^ key
+ -> Int -- ^ start
+ -> Int -- ^ end
+ -> IO (Maybe RedisReply)
+zSetReverseRange h k s e = request h $ map toUTF8 ["ZREVRANGE", k, show s, show e]
+
+
+------------------------------------------------------------------------------
+-- | ZRANGEBYSCORE
+zSetRangeByScore :: Handle
+ -> String -- ^ key
+ -> Int -- ^ mn
+ -> Int -- ^ mx
+ -> IO (Maybe RedisReply)
+zSetRangeByScore h k mn mx =
+ request h $ map toUTF8 ["ZRANGEBYSCORE", k, show mn, show mx]
+
+
+------------------------------------------------------------------------------
+-- | ZCOUNT
+zSetCount :: Handle
+ -> String -- ^ key
+ -> Int -- ^ mn
+ -> Int -- ^ mx
+ -> IO (Maybe RedisReply)
+zSetCount h k mn mx =
+ request h $ map toUTF8 ["ZCOUNT", k, show mn, show mx]
+
+
+------------------------------------------------------------------------------
+-- | ZCARD
+zSetCardinality :: Handle
+ -> String -- ^ key
+ -> IO (Maybe RedisReply)
+zSetCardinality h k = request h $ map toUTF8 ["ZCARD", k]
+
+
+------------------------------------------------------------------------------
+-- | ZSCORE
+zSetScore :: Handle
+ -> String -- ^ key
+ -> String -- ^ member
+ -> IO (Maybe RedisReply)
+zSetScore h k m = request h $ map toUTF8 ["ZSCORE", k, m]
+
+
+------------------------------------------------------------------------------
+-- | ZREMRANGEBYRANK
+zSetRemRangeByRank :: Handle
+ -> String -- ^ key
+ -> String -- ^ member
+ -> IO (Maybe RedisReply)
+zSetRemRangeByRank h k m = request h $ map toUTF8 ["ZREVRANK", k, m]
+
+
+------------------------------------------------------------------------------
+-- | ZREMRANGEBYSCORE
+zSetRemRangeByScore :: Handle
+ -> String -- ^ key
+ -> Int -- ^ start
+ -> Int -- ^ end
+ -> IO (Maybe RedisReply)
+zSetRemRangeByScore h k s e = request h $ map toUTF8 ["ZREMRANGEBYSCORE", k, show s, show e]
+
+{--
+------------------------------------------------------------------------------
+-- | ZUNIONSTORE
+zSetUnionStore :: Handle
+ -> String -- ^ key
+ -> String -- ^ member
+ -> IO (Maybe RedisReply)
+zSetUnionStore h k m = request h $ map toUTF8 ["ZUNIONSTORE", k, m]
+
+
+------------------------------------------------------------------------------
+-- | ZINTERSTORE
+zSetReverseRank :: Handle
+ -> String -- ^ key
+ -> String -- ^ member
+ -> IO (Maybe RedisReply)
+zSetReverseRank h k m = request h $ map toUTF8 ["ZREVRANK", k, m]
+
+--}
diff --git a/src/Database/Redis/String.hs b/src/Database/Redis/String.hs
index 16050e0..f6ea4a2 100644
--- a/src/Database/Redis/String.hs
+++ b/src/Database/Redis/String.hs
@@ -1,6 +1,24 @@
+-- | This module has nothing to do with Haskell @String@s; the Redis
+-- Command Reference (<http://code.google.com/p/redis/wiki/CommandReference>)
+-- confusingly refers to its simple key/value pairing as strings, even when
+-- those strings can be incremented. Unfortunately, I can't think of a better
+-- name.
+
module Database.Redis.String
( itemSet, itemSetB
+ , itemSetNX
+ , itemSetEX
, itemGet, itemGetB
+ , multiSet
+ , multiGet
+ , multiSetNX
+ , increment
+ , incrementBy
+ , decrement
+ , decrementBy
+ , itemGetSet
+ , itemAppend
+ , substring
) where
@@ -10,7 +28,8 @@ import Database.Redis.Internal
------------------------------------------------------------------------------
--- | SET
+-- | SET for @String@ arguments
+-- <http://code.google.com/p/redis/wiki/SetCommand>
itemSet :: Handle
-> String -- ^ key to set
-> String -- ^ value to set
@@ -27,27 +46,130 @@ itemSetB h key value = request h [toUTF8 "SET", key, value]
------------------------------------------------------------------------------
--- | GET
+-- | GET for a @String@ argument
+-- <http://code.google.com/p/redis/wiki/GetCommand>
itemGet :: Handle
-> String -- ^ key of the value to return
-> IO (Maybe RedisReply)
itemGet h key = request h $ map toUTF8 ["GET", key]
--- | GET for ByteString input
+
+-- | GET for a 'ByteString' argument
itemGetB :: Handle
-> ByteString -- ^ key of the value to return
-> IO (Maybe RedisReply)
itemGetB h key = request h [toUTF8 "GET", key]
-- GETSET
+------------------------------------------------------------------------------
+-- | GETSET for @String@ arguments
+-- <http://code.google.com/p/redis/wiki/GetsetCommand>
+itemGetSet :: Handle
+ -> String -- ^ key of the value to return
+ -> String -- ^ new value
+ -> IO (Maybe RedisReply)
+itemGetSet h key value = request h $ map toUTF8 ["GETSET", key, value]
+
+
+
+------------------------------------------------------------------------------
-- MGET
--- SETNX
--- SETEX
--- MSET
--- MSETNX
--- INCR
--- INCRBY
--- DECR
+multiGet :: Handle
+ -> [String] -- ^ keys from which to return a value
+ -> IO (Maybe RedisReply)
+multiGet h keys = request h $ map toUTF8 $ "MGET":keys
+
+
+------------------------------------------------------------------------------
+-- | SETNX for @String@ arguments
+-- <http://code.google.com/p/redis/wiki/SetnxCommand>
+itemSetNX :: Handle
+ -> String -- ^ key to set
+ -> String -- ^ value to set
+ -> IO (Maybe RedisReply)
+itemSetNX h key value = request h $ map toUTF8 ["SETNX", key, value]
+
+
+------------------------------------------------------------------------------
+-- | SETEX
+itemSetEX :: Handle
+ -> String -- ^ key to set
+ -> Int -- ^ number of seconds until expiration
+ -> String -- ^ value to set
+ -> IO (Maybe RedisReply)
+itemSetEX h key i value = request h $ map toUTF8 ["SETEX", key, show i, value]
+
+
+------------------------------------------------------------------------------
+-- | Calls @MSET@ <http://code.google.com/p/redis/wiki/MsetCommand> with a
+-- list of tuples (key, value)
+multiSet :: Handle
+ -> [(String, String)] -- ^ key/value pairs to set
+ -> IO (Maybe RedisReply)
+multiSet h kvs = request h $ map toUTF8 $ "MSET":(pairsToList kvs)
+
+
+------------------------------------------------------------------------------
+-- | Calls @MSETNX@ (<http://code.google.com/p/redis/wiki/MsetnxCommand>) with
+-- a list of tuples (key, value)
+multiSetNX :: Handle
+ -> [(String, String)] -- ^ key/value pairs to set
+ -> IO (Maybe RedisReply)
+multiSetNX h kvs = request h $ map toUTF8 $ "MSET":(pairsToList kvs)
+
+
+------------------------------------------------------------------------------
+-- | INCR
+increment :: Handle
+ -> String -- ^ key to increment
+ -> IO (Maybe RedisReply)
+increment h key = request h $ map toUTF8 ["INCR", key]
+
+
+------------------------------------------------------------------------------
+-- | INCRBY
+incrementBy :: Handle
+ -> String -- ^ key to increment
+ -> Int
+ -> IO (Maybe RedisReply)
+incrementBy h key i = request h $ map toUTF8 ["INCRBY", key, show i]
+
+
+------------------------------------------------------------------------------
+-- | DECR
+decrement :: Handle
+ -> String -- ^ key to decrement
+ -> IO (Maybe RedisReply)
+decrement h key = request h $ map toUTF8 ["DECR", key]
+
+
+------------------------------------------------------------------------------
-- DECRBY
--- APPEND
--- SUBSTR
+decrementBy :: Handle
+ -> String -- ^ key to decrement
+ -> Int
+ -> IO (Maybe RedisReply)
+decrementBy h key i = request h $ map toUTF8 ["DECRBY", key, show i]
+
+
+------------------------------------------------------------------------------
+-- | APPEND for @String@ arguments
+-- <http://code.google.com/p/redis/wiki/AppendCommand>
+itemAppend :: Handle
+ -> String -- ^ key to append to
+ -> String -- ^ value to append
+ -> IO (Maybe RedisReply)
+itemAppend h key value = request h $ map toUTF8 ["APPEND", key, value]
+
+
+------------------------------------------------------------------------------
+-- | SUBSTR
+substring :: Handle
+ -> String -- ^ key to append to
+ -> Int -- ^ start position
+ -> Int -- ^ end position
+ -> IO (Maybe RedisReply)
+substring h key start end =
+ request h $ map toUTF8 ["SUBSTRING", show key, show start, show end]
+
+
diff --git a/test/redis-tests.cabal b/test/redis-tests.cabal
index 737bbba..1e2a192 100644
--- a/test/redis-tests.cabal
+++ b/test/redis-tests.cabal
@@ -1,5 +1,5 @@
name: redis-tests
-version: 0.0.13
+version: 0.1.0
build-type: Simple
cabal-version: >= 1.6
diff --git a/test/suite/Database/Redis/General/Tests.hs b/test/suite/Database/Redis/General/Tests.hs
index ed2cde2..5ad84bc 100644
--- a/test/suite/Database/Redis/General/Tests.hs
+++ b/test/suite/Database/Redis/General/Tests.hs
@@ -92,8 +92,7 @@ keysTest = do
disconnect con
H.assertEqual "keys"
(Just (RedisBulk [Just (RedisBulk [Just (RedisSingle $ toUTF8 "keystest0")])
- ,Just (RedisBulk [Just (RedisSingle $ toUTF8 "keystest1")])
- ,Nothing]))
+ ,Just (RedisBulk [Just (RedisSingle $ toUTF8 "keystest1")])]))
returning
@@ -110,8 +109,7 @@ keysBTest = do
disconnect con
H.assertEqual "keysB"
(Just (RedisBulk [Just (RedisBulk [Just (RedisSingle $ toUTF8 "keystest0")])
- ,Just (RedisBulk [Just (RedisSingle $ toUTF8 "keystest1")])
- ,Nothing]))
+ ,Just (RedisBulk [Just (RedisSingle $ toUTF8 "keystest1")])]))
returning
@@ -136,8 +134,7 @@ keyRenameTest = do
_ <- keyDelete con ["success"]
disconnect con
H.assertEqual "keysRename"
- (Just (RedisBulk [Just (RedisBulk [Just (RedisSingle $ toUTF8 "success")])
- ,Nothing]))
+ (Just (RedisBulk [Just (RedisBulk [Just (RedisSingle $ toUTF8 "success")])]))
returning
diff --git a/test/suite/Database/Redis/List/Tests.hs b/test/suite/Database/Redis/List/Tests.hs
index 0eaf650..d3641b4 100644
--- a/test/suite/Database/Redis/List/Tests.hs
+++ b/test/suite/Database/Redis/List/Tests.hs
@@ -152,8 +152,7 @@ listRangeTest = do
disconnect con
H.assertEqual "listRange"
(Just (RedisBulk [Just (RedisBulk [Just (RedisSingle $ toUTF8 "value0")])
- ,Just (RedisBulk [Just (RedisSingle $ toUTF8 "value1")])
- ,Nothing]))
+ ,Just (RedisBulk [Just (RedisSingle $ toUTF8 "value1")])]))
returning
@@ -169,8 +168,7 @@ listRangeBTest = do
disconnect con
H.assertEqual "listRange"
(Just (RedisBulk [Just (RedisBulk [Just (RedisSingle $ toUTF8 "value0")])
- ,Just (RedisBulk [Just (RedisSingle $ toUTF8 "value1")])
- ,Nothing]))
+ ,Just (RedisBulk [Just (RedisSingle $ toUTF8 "value1")])]))
returning
diff --git a/test/suite/Database/Redis/Set/Tests.hs b/test/suite/Database/Redis/Set/Tests.hs
index 71663d0..ea2a744 100644
--- a/test/suite/Database/Redis/Set/Tests.hs
+++ b/test/suite/Database/Redis/Set/Tests.hs
@@ -90,8 +90,7 @@ setMembersTest = do
disconnect con
H.assertEqual "setContains"
(Just (RedisBulk [Just (RedisBulk [Just (RedisSingle $ toUTF8 "Bob")])
- ,Just (RedisBulk [Just (RedisSingle $ toUTF8 "Jane")])
- ,Nothing]))
+ ,Just (RedisBulk [Just (RedisSingle $ toUTF8 "Jane")])]))
returning
@@ -107,8 +106,7 @@ setMembersBTest = do
disconnect con
H.assertEqual "setContains"
(Just (RedisBulk [Just (RedisBulk [Just (RedisSingle $ toUTF8 "Bob")])
- ,Just (RedisBulk [Just (RedisSingle $ toUTF8 "Jane")])
- ,Nothing]))
+ ,Just (RedisBulk [Just (RedisSingle $ toUTF8 "Jane")])]))
returning
@@ -126,8 +124,7 @@ setRemoveTest = do
disconnect con
H.assertEqual "setRemove"
(Just (RedisBulk [Just (RedisBulk [Just (RedisSingle $ toUTF8 "Bob")])
- ,Just (RedisBulk [Just (RedisSingle $ toUTF8 "Jane")])
- ,Nothing]))
+ ,Just (RedisBulk [Just (RedisSingle $ toUTF8 "Jane")])]))
returning
@@ -145,8 +142,7 @@ setRemoveBTest = do
disconnect con
H.assertEqual "setRemoveB"
(Just (RedisBulk [Just (RedisBulk [Just (RedisSingle $ toUTF8 "Bob")])
- ,Just (RedisBulk [Just (RedisSingle $ toUTF8 "Jane")])
- ,Nothing]))
+ ,Just (RedisBulk [Just (RedisSingle $ toUTF8 "Jane")])]))
returning