    {-# LANGUAGE CPP #-}
    {-# LANGUAGE StandaloneDeriving #-}
    {-# LANGUAGE GeneralizedNewtypeDeriving #-}

    module Database.Redis.Core.Internal where
    #if __GLASGOW_HASKELL__ > 711 && __GLASGOW_HASKELL__ < 808
    import Control.Monad.Fail (MonadFail)
    #endif
    import Control.Monad.Reader
    import Data.IORef
    import Database.Redis.Protocol
    import qualified Database.Redis.ProtocolPipelining as PP

    -- |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.
    newtype Redis a =
      Redis (ReaderT RedisEnv IO a)
      deriving (Applicative Redis
    a -> Redis a
    Applicative Redis =>
    (forall a b. Redis a -> (a -> Redis b) -> Redis b)
    -> (forall a b. Redis a -> Redis b -> Redis b)
    -> (forall a. a -> Redis a)
    -> Monad Redis
    Redis a -> (a -> Redis b) -> Redis b
    Redis a -> Redis b -> Redis b
    forall a. a -> Redis a
    forall a b. Redis a -> Redis b -> Redis b
    forall a b. Redis a -> (a -> Redis b) -> Redis b
    forall (m :: * -> *).
    Applicative m =>
    (forall a b. m a -> (a -> m b) -> m b)
    -> (forall a b. m a -> m b -> m b)
    -> (forall a. a -> m a)
    -> Monad m
    return :: a -> Redis a
    $creturn :: forall a. a -> Redis a
    >> :: Redis a -> Redis b -> Redis b
    $c>> :: forall a b. Redis a -> Redis b -> Redis b
    >>= :: Redis a -> (a -> Redis b) -> Redis b
    $c>>= :: forall a b. Redis a -> (a -> Redis b) -> Redis b
    $cp1Monad :: Applicative Redis
    Monad, Monad Redis
    Monad Redis => (forall a. IO a -> Redis a) -> MonadIO Redis
    IO a -> Redis a
    forall a. IO a -> Redis a
    forall (m :: * -> *).
    Monad m =>
    (forall a. IO a -> m a) -> MonadIO m
    liftIO :: IO a -> Redis a
    $cliftIO :: forall a. IO a -> Redis a
    $cp1MonadIO :: Monad Redis
    MonadIO, a -> Redis b -> Redis a
    (a -> b) -> Redis a -> Redis b
    (forall a b. (a -> b) -> Redis a -> Redis b)
    -> (forall a b. a -> Redis b -> Redis a) -> Functor Redis
    forall a b. a -> Redis b -> Redis a
    forall a b. (a -> b) -> Redis a -> Redis b
    forall (f :: * -> *).
    (forall a b. (a -> b) -> f a -> f b)
    -> (forall a b. a -> f b -> f a) -> Functor f
    <$ :: a -> Redis b -> Redis a
    $c<$ :: forall a b. a -> Redis b -> Redis a
    fmap :: (a -> b) -> Redis a -> Redis b
    $cfmap :: forall a b. (a -> b) -> Redis a -> Redis b
    Functor, Functor Redis
    a -> Redis a
    Functor Redis =>
    (forall a. a -> Redis a)
    -> (forall a b. Redis (a -> b) -> Redis a -> Redis b)
    -> (forall a b c. (a -> b -> c) -> Redis a -> Redis b -> Redis c)
    -> (forall a b. Redis a -> Redis b -> Redis b)
    -> (forall a b. Redis a -> Redis b -> Redis a)
    -> Applicative Redis
    Redis a -> Redis b -> Redis b
    Redis a -> Redis b -> Redis a
    Redis (a -> b) -> Redis a -> Redis b
    (a -> b -> c) -> Redis a -> Redis b -> Redis c
    forall a. a -> Redis a
    forall a b. Redis a -> Redis b -> Redis a
    forall a b. Redis a -> Redis b -> Redis b
    forall a b. Redis (a -> b) -> Redis a -> Redis b
    forall a b c. (a -> b -> c) -> Redis a -> Redis b -> Redis c
    forall (f :: * -> *).
    Functor f =>
    (forall a. a -> f a)
    -> (forall a b. f (a -> b) -> f a -> f b)
    -> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
    -> (forall a b. f a -> f b -> f b)
    -> (forall a b. f a -> f b -> f a)
    -> Applicative f
    <* :: Redis a -> Redis b -> Redis a
    $c<* :: forall a b. Redis a -> Redis b -> Redis a
    *> :: Redis a -> Redis b -> Redis b
    $c*> :: forall a b. Redis a -> Redis b -> Redis b
    liftA2 :: (a -> b -> c) -> Redis a -> Redis b -> Redis c
    $cliftA2 :: forall a b c. (a -> b -> c) -> Redis a -> Redis b -> Redis c
    <*> :: Redis (a -> b) -> Redis a -> Redis b
    $c<*> :: forall a b. Redis (a -> b) -> Redis a -> Redis b
    pure :: a -> Redis a
    $cpure :: forall a. a -> Redis a
    $cp1Applicative :: Functor Redis
    Applicative)
    #if __GLASGOW_HASKELL__ > 711
    deriving instance MonadFail Redis
    #endif
    data RedisEnv =
      Env
        { RedisEnv -> Connection
    envConn :: PP.Connection
        , RedisEnv -> IORef Reply
    envLastReply :: IORef Reply
        }