{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE Safe #-} {-# LANGUAGE UndecidableInstances #-} module Network.Tox.Timed where import Control.Monad (Monad) import Control.Monad.Random (RandT) import Control.Monad.Reader (ReaderT) import Control.Monad.RWS (RWST) import Control.Monad.State (StateT) import Control.Monad.Trans (lift) import Control.Monad.Writer (WriterT) import Data.Monoid (Monoid) import Network.Tox.Time (Timestamp) class Monad m => Timed m where askTime :: m Timestamp instance Timed m => Timed (ReaderT r m) where askTime :: ReaderT r m Timestamp askTime = m Timestamp -> ReaderT r m Timestamp forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift m Timestamp forall (m :: * -> *). Timed m => m Timestamp askTime instance (Monoid w, Timed m) => Timed (WriterT w m) where askTime :: WriterT w m Timestamp askTime = m Timestamp -> WriterT w m Timestamp forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift m Timestamp forall (m :: * -> *). Timed m => m Timestamp askTime instance Timed m => Timed (StateT s m) where askTime :: StateT s m Timestamp askTime = m Timestamp -> StateT s m Timestamp forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift m Timestamp forall (m :: * -> *). Timed m => m Timestamp askTime instance (Monoid w, Timed m) => Timed (RWST r w s m) where askTime :: RWST r w s m Timestamp askTime = m Timestamp -> RWST r w s m Timestamp forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift m Timestamp forall (m :: * -> *). Timed m => m Timestamp askTime instance Timed m => Timed (RandT s m) where askTime :: RandT s m Timestamp askTime = m Timestamp -> RandT s m Timestamp forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift m Timestamp forall (m :: * -> *). Timed m => m Timestamp askTime