Monadic wrapper for Database.Redis.Redis

- class MonadIO m => WithRedis m where
- data Redis = Redis {}
- data BS s => Reply s
- data Interval a
- class IsInterval i a | i -> a where
- toInterval :: i -> Interval a

- data BS s => SortOptions s = SortOptions {}
- data Aggregate
- sortDefaults :: SortOptions ByteString
- fromRInline :: (Monad m, BS s) => Reply s -> m s
- fromRBulk :: (Monad m, BS s) => Reply s -> m (Maybe s)
- fromRMulti :: (Monad m, BS s) => Reply s -> m (Maybe [Reply s])
- fromRMultiBulk :: (Monad m, BS s) => Reply s -> m (Maybe [Maybe s])
- fromRInt :: (Monad m, BS s) => Reply s -> m Int
- fromROk :: (Monad m, BS s) => Reply s -> m ()
- noError :: (Monad m, BS s) => Reply s -> m ()
- takeAll :: (Int, Int)
- localhost :: String
- defaultPort :: String
- connect :: WithRedis m => String -> String -> m ()
- disconnect :: WithRedis m => m ()
- isConnected :: WithRedis m => m Bool
- ping :: WithRedis m => m (Reply ())
- auth :: WithRedis m => String -> m (Reply ())
- quit :: WithRedis m => m ()
- shutdown :: WithRedis m => m ()
- multi :: WithRedis m => m (Reply ())
- exec :: (WithRedis m, BS s) => m (Reply s)
- discard :: WithRedis m => m (Reply ())
- run_multi :: (WithRedis m, BS s) => [m (Reply ())] -> m (Reply s)
- exists :: (WithRedis m, BS s) => s -> m (Reply Int)
- del :: (WithRedis m, BS s) => s -> m (Reply Int)
- getType :: (WithRedis m, BS s1, BS s2) => s1 -> m (Reply s2)
- keys :: (WithRedis m, BS s1, BS s2) => s1 -> m (Reply s2)
- randomKey :: (WithRedis m, BS s) => m (Reply s)
- rename :: (WithRedis m, BS s1, BS s2) => s1 -> s2 -> m (Reply ())
- renameNx :: (WithRedis m, BS s1, BS s2) => s1 -> s2 -> m (Reply Int)
- dbsize :: WithRedis m => m (Reply Int)
- expire :: (WithRedis m, BS s) => s -> Int -> m (Reply Int)
- expireAt :: (WithRedis m, BS s) => s -> Int -> m (Reply Int)
- ttl :: (WithRedis m, BS s) => s -> m (Reply Int)
- select :: WithRedis m => Int -> m (Reply ())
- move :: (WithRedis m, BS s) => s -> Int -> m (Reply Int)
- flushDb :: WithRedis m => m (Reply ())
- flushAll :: WithRedis m => m (Reply ())
- info :: (WithRedis m, BS s) => m (Reply s)
- set :: (WithRedis m, BS s1, BS s2) => s1 -> s2 -> m (Reply ())
- setNx :: (WithRedis m, BS s1, BS s2) => s1 -> s2 -> m (Reply Int)
- mSet :: (WithRedis m, BS s1, BS s2) => [(s1, s2)] -> m (Reply ())
- mSetNx :: (WithRedis m, BS s1, BS s2) => [(s1, s2)] -> m (Reply Int)
- get :: (WithRedis m, BS s1, BS s2) => s1 -> m (Reply s2)
- getSet :: (WithRedis m, BS s1, BS s2, BS s3) => s1 -> s2 -> m (Reply s3)
- mGet :: (WithRedis m, BS s1, BS s2) => [s1] -> m (Reply s2)
- incr :: (WithRedis m, BS s) => s -> m (Reply Int)
- incrBy :: (WithRedis m, BS s) => s -> Int -> m (Reply Int)
- decr :: (WithRedis m, BS s) => s -> m (Reply Int)
- decrBy :: (WithRedis m, BS s) => s -> Int -> m (Reply Int)
- append :: (WithRedis m, BS s1, BS s2) => s1 -> s2 -> m (Reply Int)
- substr :: (WithRedis m, BS s1, BS s2) => s1 -> (Int, Int) -> m (Reply s2)
- rpush :: (WithRedis m, BS s1, BS s2) => s1 -> s2 -> m (Reply Int)
- lpush :: (WithRedis m, BS s1, BS s2) => s1 -> s2 -> m (Reply Int)
- llen :: (WithRedis m, BS s) => s -> m (Reply Int)
- lrange :: (WithRedis m, BS s1, BS s2) => s1 -> (Int, Int) -> m (Reply s2)
- ltrim :: (WithRedis m, BS s) => s -> (Int, Int) -> m (Reply ())
- lindex :: (WithRedis m, BS s1, BS s2) => s1 -> Int -> m (Reply s2)
- lset :: (WithRedis m, BS s1, BS s2) => s1 -> Int -> s2 -> m (Reply ())
- lrem :: (WithRedis m, BS s1, BS s2) => s1 -> Int -> s2 -> m (Reply Int)
- lpop :: (WithRedis m, BS s1, BS s2) => s1 -> m (Reply s2)
- rpop :: (WithRedis m, BS s1, BS s2) => s1 -> m (Reply s2)
- rpoplpush :: (WithRedis m, BS s1, BS s2, BS s3) => s1 -> s2 -> m (Reply s3)
- blpop :: (WithRedis m, BS s1, BS s2) => [s1] -> Int -> m (Reply s2)
- brpop :: (WithRedis m, BS s1, BS s2) => [s1] -> Int -> m (Reply s2)
- sadd :: (WithRedis m, BS s1, BS s2) => s1 -> s2 -> m (Reply Int)
- srem :: (WithRedis m, BS s1, BS s2) => s1 -> s2 -> m (Reply Int)
- spop :: (WithRedis m, BS s1, BS s2) => s1 -> m (Reply s2)
- smove :: (WithRedis m, BS s1, BS s2, BS s3) => s1 -> s2 -> s3 -> m (Reply Int)
- scard :: (WithRedis m, BS s) => s -> m (Reply Int)
- sismember :: (WithRedis m, BS s) => s -> m (Reply Int)
- smembers :: (WithRedis m, BS s1, BS s2) => s1 -> m (Reply s2)
- srandmember :: (WithRedis m, BS s1, BS s2) => s1 -> m (Reply s2)
- sinter :: (WithRedis m, BS s1, BS s2) => [s1] -> m (Reply s2)
- sinterStore :: (WithRedis m, BS s1, BS s2) => s1 -> [s2] -> m (Reply ())
- sunion :: (WithRedis m, BS s1, BS s2) => [s1] -> m (Reply s2)
- sunionStore :: (WithRedis m, BS s1, BS s2) => s1 -> [s2] -> m (Reply ())
- sdiff :: (WithRedis m, BS s1, BS s2) => [s1] -> m (Reply s2)
- sdiffStore :: (WithRedis m, BS s1, BS s2) => s1 -> [s2] -> m (Reply ())
- zadd :: (WithRedis m, BS s1, BS s2) => s1 -> Double -> s2 -> m (Reply Int)
- zrem :: (WithRedis m, BS s1, BS s2) => s1 -> s2 -> m (Reply Int)
- zincrBy :: (WithRedis m, BS s1, BS s2, BS s3) => s1 -> Double -> s2 -> m (Reply s3)
- zrange :: (WithRedis m, BS s1, BS s2) => s1 -> (Int, Int) -> Bool -> m (Reply s2)
- zrevrange :: (WithRedis m, BS s1, BS s2) => s1 -> (Int, Int) -> Bool -> m (Reply s2)
- zrangebyscore :: (WithRedis m, IsInterval i Double, BS s1, BS s2) => s1 -> i -> Bool -> m (Reply s2)
- zcount :: (WithRedis m, IsInterval i Double, BS s) => s -> i -> m (Reply Int)
- zremrangebyscore :: (WithRedis m, BS s) => s -> (Double, Double) -> m (Reply Int)
- zcard :: (WithRedis m, BS s) => s -> m (Reply Int)
- zscore :: (WithRedis m, BS s1, BS s2, BS s3) => s1 -> s2 -> m (Reply s3)
- zrank :: (WithRedis m, BS s1, BS s2) => s1 -> s2 -> m (Reply Int)
- zrevrank :: (WithRedis m, BS s1, BS s2) => s1 -> s2 -> m (Reply Int)
- zremrangebyrank :: (WithRedis m, BS s) => s -> (Int, Int) -> m (Reply Int)
- zunion :: (WithRedis m, BS s1, BS s2) => s1 -> [s2] -> [Double] -> Aggregate -> m (Reply Int)
- zinter :: (WithRedis m, BS s1, BS s2) => s1 -> [s2] -> [Double] -> Aggregate -> m (Reply Int)
- hset :: (WithRedis m, BS s1, BS s2, BS s3) => s1 -> s2 -> s3 -> m (Reply Int)
- hget :: (WithRedis m, BS s1, BS s2, BS s3) => s1 -> s2 -> m (Reply s3)
- hdel :: (WithRedis m, BS s1, BS s2) => s1 -> s2 -> m (Reply Int)
- hexists :: (WithRedis m, BS s1, BS s2) => s1 -> s2 -> m (Reply Int)
- hlen :: (WithRedis m, BS s) => s -> m (Reply Int)
- hkeys :: (WithRedis m, BS s1, BS s2) => s1 -> m (Reply s2)
- hvals :: (WithRedis m, BS s1, BS s2) => s1 -> m (Reply s2)
- hgetall :: (WithRedis m, BS s1, BS s2) => s1 -> m (Reply s2)
- sort :: (WithRedis m, BS s1, BS s2, BS s3) => s1 -> SortOptions s2 -> m (Reply s3)
- listRelated :: (WithRedis m, BS s1, BS s2, BS s3) => s1 -> s2 -> (Int, Int) -> m (Reply s3)
- save :: WithRedis m => m (Reply ())
- bgsave :: WithRedis m => m (Reply ())
- lastsave :: WithRedis m => m (Reply Int)
- bgrewriteaof :: WithRedis m => m (Reply ())

# Types ans Constructors

Redis connection descriptor

Redis reply variants

RTimeout | Timeout. Currently unused |

ROk | "Ok" reply |

RPong | Reply for the ping command |

RQueued | Used inside multi-exec block |

RError String | Some kind of server-side error |

RInline s | Simple oneline reply |

RInt Int | Integer reply |

RBulk (Maybe s) | Multiline reply |

RMulti (Maybe [Reply s]) | Complex reply. It may consists of various type of replys |

Interval representation

Closed a a | closed interval [a, b] |

Open a a | open interval (a, b) |

LeftOpen a a | left-open interval (a, b] |

RightOpen a a | right-open interval [a, b) |

Show a => Show (Interval a) | |

IsInterval (Interval a) a | Trivial IsInterval instance |

class IsInterval i a | i -> a whereSource

Class for conversion value to `Interval`

Definied instances is:

- the Interval itself
- pair (a,b) for open interval
- two-member list [a, b] for closed interval (throws runtime error if the list length is different)

toInterval :: i -> Interval aSource

IsInterval [a] a | Two-element list [a, b] converted to closed interval. No static checking of list length performed. |

IsInterval (Interval a) a | Trivial IsInterval instance |

IsInterval (a, a) a | Pair (a, b) converted to open interval |

data BS s => SortOptions s Source

Options data type for the `sort`

command

sortDefaults :: SortOptions ByteStringSource

Default options for the `sort`

command

fromRInline :: (Monad m, BS s) => Reply s -> m sSource

Unwraps RInline reply.

Throws an exception when called with something different from RInline

fromRBulk :: (Monad m, BS s) => Reply s -> m (Maybe s)Source

Unwraps RBulk reply.

Throws an exception when called with something different from RBulk

fromRMulti :: (Monad m, BS s) => Reply s -> m (Maybe [Reply s])Source

Unwraps RMulti reply

Throws an exception when called with something different from RMulti

fromRMultiBulk :: (Monad m, BS s) => Reply s -> m (Maybe [Maybe s])Source

Unwraps RMulti reply filled with RBulk

Throws an exception when called with something different from RMulti

fromRInt :: (Monad m, BS s) => Reply s -> m IntSource

Unwraps RInt reply

Throws an exception when called with something different from RInt

fromROk :: (Monad m, BS s) => Reply s -> m ()Source

Unwraps ROk reply

Throws an exception when called with something different from ROk

noError :: (Monad m, BS s) => Reply s -> m ()Source

Unwraps every non-error reply

Throws an exception when called with something different from RMulti

a (0, -1) range - takes all element from a list in lrange, zrange and so on

# Database connection

default Redis port

disconnect :: WithRedis m => m ()Source

isConnected :: WithRedis m => m BoolSource

# Redis commands

## Generic

## Strings

## Lists

## Sets

## Sorted sets

zrangebyscore :: (WithRedis m, IsInterval i Double, BS s1, BS s2) => s1 -> i -> Bool -> m (Reply s2)Source

## Hashes

## Sorting

## Persistent control

bgrewriteaof :: WithRedis m => m (Reply ())Source