-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Backend for persistent library using Redis.
--   
--   Based on the Redis package.
@package persistent-redis
@version 2.5.2.2

module Database.Persist.Redis
newtype RedisAuth
RedisAuth :: Text -> RedisAuth

-- | Information required to connect to a Redis server
data RedisConf
RedisConf :: Text -> PortID -> Maybe RedisAuth -> Int -> RedisConf

-- | Host
[rdHost] :: RedisConf -> Text

-- | Port
[rdPort] :: RedisConf -> PortID

-- | Auth info
[rdAuth] :: RedisConf -> Maybe RedisAuth

-- | Maximum number of connections
[rdMaxConn] :: RedisConf -> Int

-- | This class captures the following behaviour: In a context <tt>m</tt>,
--   a command will return its result wrapped in a "container" of type
--   <tt>f</tt>.
--   
--   Please refer to the Command Type Signatures section of this page for
--   more information.
class MonadRedis m => RedisCtx (m :: * -> *) (f :: * -> *) | m -> f

-- | Context for normal command execution, outside of transactions. Use
--   <a>runRedis</a> to run actions of this type.
--   
--   In this context, each result is wrapped in an <a>Either</a> to account
--   for the possibility of Redis returning an <a>Error</a> reply.
data Redis a :: * -> *

-- | A threadsafe pool of network connections to a Redis server. Use the
--   <a>connect</a> function to create one.
data Connection :: *
data PortID :: *
Service :: String -> PortID
PortNumber :: PortNumber -> PortID
UnixSocket :: String -> PortID

-- | Monad reader transformer keeping Redis connection through out the work
type RedisT = ReaderT Connection
runRedisPool :: RedisT m a -> Connection -> m a

-- | Run a connection reader function against a Redis configuration
withRedisConn :: (Monad m, MonadIO m) => RedisConf -> (Connection -> m a) -> m a

-- | Extracts connection from RedisT monad transformer
thisConnection :: Monad m => RedisT m Connection

-- | Execute Redis transaction inside RedisT monad transformer
execRedisT :: (Monad m, MonadIO m) => RedisTx (Queued a) -> RedisT m a
type RedisBackend = Connection
data RedisException
NotSupportedOperation :: String -> RedisException
ParserError :: String -> RedisException
NotSupportedValueType :: String -> RedisException
IncorrectUpdate :: String -> RedisException
IncorrectBehavior :: RedisException
