hedis
Safe HaskellNone
LanguageHaskell2010

Database.Redis.Core

Synopsis

Documentation

data Redis a Source #

Context for normal command execution, outside of transactions. Use runRedis to run actions of this type.

In this context, each result is wrapped in an Either to account for the possibility of Redis returning an Error reply.

Instances

Instances details
MonadIO Redis Source # 
Instance details

Defined in Database.Redis.Core.Internal

Methods

liftIO :: IO a -> Redis a #

MonadCatch Redis Source # 
Instance details

Defined in Database.Redis.Core.Internal

Methods

catch :: (HasCallStack, Exception e) => Redis a -> (e -> Redis a) -> Redis a #

MonadMask Redis Source # 
Instance details

Defined in Database.Redis.Core.Internal

Methods

mask :: HasCallStack => ((forall a. Redis a -> Redis a) -> Redis b) -> Redis b #

uninterruptibleMask :: HasCallStack => ((forall a. Redis a -> Redis a) -> Redis b) -> Redis b #

generalBracket :: HasCallStack => Redis a -> (a -> ExitCase b -> Redis c) -> (a -> Redis b) -> Redis (b, c) #

MonadThrow Redis Source # 
Instance details

Defined in Database.Redis.Core.Internal

Methods

throwM :: (HasCallStack, Exception e) => e -> Redis a #

Applicative Redis Source # 
Instance details

Defined in Database.Redis.Core.Internal

Methods

pure :: a -> Redis a #

(<*>) :: Redis (a -> b) -> Redis a -> Redis b #

liftA2 :: (a -> b -> c) -> Redis a -> Redis b -> Redis c #

(*>) :: Redis a -> Redis b -> Redis b #

(<*) :: Redis a -> Redis b -> Redis a #

Functor Redis Source # 
Instance details

Defined in Database.Redis.Core.Internal

Methods

fmap :: (a -> b) -> Redis a -> Redis b #

(<$) :: a -> Redis b -> Redis a #

Monad Redis Source # 
Instance details

Defined in Database.Redis.Core.Internal

Methods

(>>=) :: Redis a -> (a -> Redis b) -> Redis b #

(>>) :: Redis a -> Redis b -> Redis b #

return :: a -> Redis a #

MonadFail Redis Source # 
Instance details

Defined in Database.Redis.Core.Internal

Methods

fail :: String -> Redis a #

MonadRedis Redis Source # 
Instance details

Defined in Database.Redis.Core

Methods

liftRedis :: Redis a -> Redis a Source #

MonadUnliftIO Redis Source # 
Instance details

Defined in Database.Redis.Core.Internal

Methods

withRunInIO :: ((forall a. Redis a -> IO a) -> IO b) -> Redis b #

RedisCtx Redis (Either Reply) Source # 
Instance details

Defined in Database.Redis.Core

unRedis :: Redis a -> ReaderT RedisEnv IO a Source #

Deconstruct Redis constructor.

unRedis and reRedis can be used to define instances for arbitrary typeclasses.

WARNING! These functions are considered internal and no guarantee is given at this point that they will not break in future.

reRedis :: ReaderT RedisEnv IO a -> Redis a Source #

Reconstruct Redis constructor.

class MonadRedis m => RedisCtx (m :: Type -> Type) (f :: Type -> Type) | m -> f where Source #

This class captures the following behaviour: In a context m, a command will return its result wrapped in a "container" of type f.

Please refer to the Command Type Signatures section of this page for more information.

Methods

returnDecode :: RedisResult a => Reply -> m (f a) Source #

Instances

Instances details
RedisCtx RedisTx Queued Source # 
Instance details

Defined in Database.Redis.Transactions

RedisCtx Redis (Either Reply) Source # 
Instance details

Defined in Database.Redis.Core

class Monad m => MonadRedis (m :: Type -> Type) where Source #

Methods

liftRedis :: Redis a -> m a Source #

Instances

Instances details
MonadRedis Redis Source # 
Instance details

Defined in Database.Redis.Core

Methods

liftRedis :: Redis a -> Redis a Source #

MonadRedis RedisTx Source # 
Instance details

Defined in Database.Redis.Transactions

Methods

liftRedis :: Redis a -> RedisTx a Source #

(MonadTrans t, MonadRedis m, Monad (t m)) => MonadRedis (t m) Source # 
Instance details

Defined in Database.Redis.Core

Methods

liftRedis :: Redis a -> t m a Source #

data Hooks Source #

A collection of hook functions used by a connection.

Instances

Instances details
Show Hooks Source # 
Instance details

Defined in Database.Redis.Hooks

Methods

showsPrec :: Int -> Hooks -> ShowS #

show :: Hooks -> String #

showList :: [Hooks] -> ShowS #

type SendRequestHook = ([ByteString] -> IO Reply) -> [ByteString] -> IO Reply Source #

A hook for sending commands to the server and receiving replies from the server.

This wraps the command-level request path used by most Redis commands.

type SendPubSubHook = ([ByteString] -> IO ()) -> [ByteString] -> IO () Source #

A hook for sending pub/sub messages to the server.

type CallbackHook = (Message -> IO PubSub) -> Message -> IO PubSub Source #

A hook for invoking callbacks with pub/sub messages.

type SendHook = (ByteString -> IO ()) -> ByteString -> IO () Source #

A hook for sending raw bytes to the server.

This sits below request rendering and can be used to observe the exact wire payload sent on the socket.

type ReceiveHook = IO Reply -> IO Reply Source #

A hook for receiving replies from the server.

send :: MonadRedis m => [ByteString] -> m () Source #

sendRequest :: (RedisCtx m f, RedisResult a) => [ByteString] -> m (f a) Source #

sendRequest can be used to implement commands from experimental versions of Redis. An example of how to implement a command is given below.

-- |Redis DEBUG OBJECT command
debugObject :: ByteString -> Redis (Either Reply ByteString)
debugObject key = sendRequest ["DEBUG", "OBJECT", key]

runRedisInternal :: Connection -> Redis a -> IO a Source #

Internal version of runRedis that does not depend on the Connection abstraction. Used to run the AUTH command when connecting.

defaultHooks :: Hooks Source #

The default hooks.

Every hook is the identity function, so installing defaultHooks has no effect on behavior.