{-# OPTIONS_GHC -fno-warn-orphans -fno-warn-warnings-deprecations #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE PackageImports #-}
module Snap.Internal.Instances () where
import Control.Monad.Trans.Class (MonadTrans (lift))
import Control.Monad.Trans.Error (Error, ErrorT)
#if MIN_VERSION_transformers(0,4,0)
import Control.Monad.Trans.Except (ExceptT)
#endif
import Control.Monad.Trans.List (ListT)
import Control.Monad.Trans.Reader (ReaderT)
import qualified Control.Monad.Trans.RWS.Lazy as LRWS (RWST)
import Control.Monad.Trans.RWS.Strict (RWST)
import qualified Control.Monad.Trans.State.Lazy as LState (StateT)
import Control.Monad.Trans.State.Strict (StateT)
import qualified Control.Monad.Trans.Writer.Lazy as LWriter (WriterT)
import Control.Monad.Trans.Writer.Strict (WriterT)
import Snap.Internal.Core (MonadSnap (..))
#if !MIN_VERSION_base(4,8,0)
import Data.Monoid (Monoid)
#endif
instance (MonadSnap m, Error e) => MonadSnap (ErrorT e m) where
liftSnap :: Snap a -> ErrorT e m a
liftSnap = m a -> ErrorT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m a -> ErrorT e m a) -> (Snap a -> m a) -> Snap a -> ErrorT e m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Snap a -> m a
forall (m :: * -> *) a. MonadSnap m => Snap a -> m a
liftSnap
#if MIN_VERSION_transformers(0,4,0)
instance (MonadSnap m, Monoid e) => MonadSnap (ExceptT e m) where
liftSnap :: Snap a -> ExceptT e m a
liftSnap = m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m a -> ExceptT e m a)
-> (Snap a -> m a) -> Snap a -> ExceptT e m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Snap a -> m a
forall (m :: * -> *) a. MonadSnap m => Snap a -> m a
liftSnap
#endif
instance MonadSnap m => MonadSnap (ListT m) where
liftSnap :: Snap a -> ListT m a
liftSnap = m a -> ListT m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m a -> ListT m a) -> (Snap a -> m a) -> Snap a -> ListT m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Snap a -> m a
forall (m :: * -> *) a. MonadSnap m => Snap a -> m a
liftSnap
instance (MonadSnap m, Monoid w) => MonadSnap (RWST r w s m) where
liftSnap :: Snap a -> RWST r w s m a
liftSnap = m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m a -> RWST r w s m a)
-> (Snap a -> m a) -> Snap a -> RWST r w s m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Snap a -> m a
forall (m :: * -> *) a. MonadSnap m => Snap a -> m a
liftSnap
instance (MonadSnap m, Monoid w) => MonadSnap (LRWS.RWST r w s m) where
liftSnap :: Snap a -> RWST r w s m a
liftSnap = m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m a -> RWST r w s m a)
-> (Snap a -> m a) -> Snap a -> RWST r w s m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Snap a -> m a
forall (m :: * -> *) a. MonadSnap m => Snap a -> m a
liftSnap
instance MonadSnap m => MonadSnap (ReaderT r m) where
liftSnap :: Snap a -> ReaderT r m a
liftSnap = m a -> ReaderT r m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m a -> ReaderT r m a)
-> (Snap a -> m a) -> Snap a -> ReaderT r m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Snap a -> m a
forall (m :: * -> *) a. MonadSnap m => Snap a -> m a
liftSnap
instance MonadSnap m => MonadSnap (StateT s m) where
liftSnap :: Snap a -> StateT s m a
liftSnap = m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m a -> StateT s m a) -> (Snap a -> m a) -> Snap a -> StateT s m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Snap a -> m a
forall (m :: * -> *) a. MonadSnap m => Snap a -> m a
liftSnap
instance MonadSnap m => MonadSnap (LState.StateT s m) where
liftSnap :: Snap a -> StateT s m a
liftSnap = m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m a -> StateT s m a) -> (Snap a -> m a) -> Snap a -> StateT s m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Snap a -> m a
forall (m :: * -> *) a. MonadSnap m => Snap a -> m a
liftSnap
instance (MonadSnap m, Monoid w) => MonadSnap (WriterT w m) where
liftSnap :: Snap a -> WriterT w m a
liftSnap = m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m a -> WriterT w m a)
-> (Snap a -> m a) -> Snap a -> WriterT w m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Snap a -> m a
forall (m :: * -> *) a. MonadSnap m => Snap a -> m a
liftSnap
instance (MonadSnap m, Monoid w) => MonadSnap (LWriter.WriterT w m) where
liftSnap :: Snap a -> WriterT w m a
liftSnap = m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m a -> WriterT w m a)
-> (Snap a -> m a) -> Snap a -> WriterT w m a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Snap a -> m a
forall (m :: * -> *) a. MonadSnap m => Snap a -> m a
liftSnap