{-# OPTIONS_GHC -Wno-orphans #-}

module Control.Monad.Class.MonadTime.Trans () where

import           Control.Monad.Cont (ContT)
import           Control.Monad.Except (ExceptT)
import qualified Control.Monad.RWS.Lazy as Lazy
import qualified Control.Monad.RWS.Strict as Strict
import qualified Control.Monad.State.Lazy as Lazy
import qualified Control.Monad.State.Strict as Strict
import           Control.Monad.Trans (lift)
import qualified Control.Monad.Writer.Lazy as Lazy
import qualified Control.Monad.Writer.Strict as Strict

import           Control.Monad.Class.MonadTime

instance MonadMonotonicTimeNSec m => MonadMonotonicTimeNSec (ExceptT e m) where
  getMonotonicTimeNSec :: ExceptT e m Word64
getMonotonicTimeNSec = m Word64 -> ExceptT e m Word64
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m Word64
forall (m :: * -> *). MonadMonotonicTimeNSec m => m Word64
getMonotonicTimeNSec

instance MonadMonotonicTimeNSec m => MonadMonotonicTimeNSec (Lazy.StateT s m) where
  getMonotonicTimeNSec :: StateT s m Word64
getMonotonicTimeNSec = m Word64 -> StateT s m Word64
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m Word64
forall (m :: * -> *). MonadMonotonicTimeNSec m => m Word64
getMonotonicTimeNSec

instance MonadMonotonicTimeNSec m => MonadMonotonicTimeNSec (Strict.StateT s m) where
  getMonotonicTimeNSec :: StateT s m Word64
getMonotonicTimeNSec = m Word64 -> StateT s m Word64
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m Word64
forall (m :: * -> *). MonadMonotonicTimeNSec m => m Word64
getMonotonicTimeNSec

instance (Monoid w, MonadMonotonicTimeNSec m) => MonadMonotonicTimeNSec (Lazy.WriterT w m) where
  getMonotonicTimeNSec :: WriterT w m Word64
getMonotonicTimeNSec = m Word64 -> WriterT w m Word64
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m Word64
forall (m :: * -> *). MonadMonotonicTimeNSec m => m Word64
getMonotonicTimeNSec

instance (Monoid w, MonadMonotonicTimeNSec m) => MonadMonotonicTimeNSec (Strict.WriterT w m) where
  getMonotonicTimeNSec :: WriterT w m Word64
getMonotonicTimeNSec = m Word64 -> WriterT w m Word64
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m Word64
forall (m :: * -> *). MonadMonotonicTimeNSec m => m Word64
getMonotonicTimeNSec

instance (Monoid w, MonadMonotonicTimeNSec m) => MonadMonotonicTimeNSec (Lazy.RWST r w s m) where
  getMonotonicTimeNSec :: RWST r w s m Word64
getMonotonicTimeNSec = m Word64 -> RWST r w s m Word64
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m Word64
forall (m :: * -> *). MonadMonotonicTimeNSec m => m Word64
getMonotonicTimeNSec

instance (Monoid w, MonadMonotonicTimeNSec m) => MonadMonotonicTimeNSec (Strict.RWST r w s m) where
  getMonotonicTimeNSec :: RWST r w s m Word64
getMonotonicTimeNSec = m Word64 -> RWST r w s m Word64
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m Word64
forall (m :: * -> *). MonadMonotonicTimeNSec m => m Word64
getMonotonicTimeNSec

instance MonadMonotonicTimeNSec m => MonadMonotonicTimeNSec (ContT r m) where
  getMonotonicTimeNSec :: ContT r m Word64
getMonotonicTimeNSec = m Word64 -> ContT r m Word64
forall (m :: * -> *) a. Monad m => m a -> ContT r m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m Word64
forall (m :: * -> *). MonadMonotonicTimeNSec m => m Word64
getMonotonicTimeNSec

instance MonadTime m => MonadTime (ExceptT e m) where
  getCurrentTime :: ExceptT e m UTCTime
getCurrentTime   = m UTCTime -> ExceptT e m UTCTime
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m UTCTime
forall (m :: * -> *). MonadTime m => m UTCTime
getCurrentTime

instance MonadTime m => MonadTime (Lazy.StateT s m) where
  getCurrentTime :: StateT s m UTCTime
getCurrentTime = m UTCTime -> StateT s m UTCTime
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m UTCTime
forall (m :: * -> *). MonadTime m => m UTCTime
getCurrentTime

instance MonadTime m => MonadTime (Strict.StateT s m) where
  getCurrentTime :: StateT s m UTCTime
getCurrentTime = m UTCTime -> StateT s m UTCTime
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m UTCTime
forall (m :: * -> *). MonadTime m => m UTCTime
getCurrentTime

instance (Monoid w, MonadTime m) => MonadTime (Lazy.WriterT w m) where
  getCurrentTime :: WriterT w m UTCTime
getCurrentTime = m UTCTime -> WriterT w m UTCTime
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m UTCTime
forall (m :: * -> *). MonadTime m => m UTCTime
getCurrentTime

instance (Monoid w, MonadTime m) => MonadTime (Strict.WriterT w m) where
  getCurrentTime :: WriterT w m UTCTime
getCurrentTime = m UTCTime -> WriterT w m UTCTime
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m UTCTime
forall (m :: * -> *). MonadTime m => m UTCTime
getCurrentTime

instance (Monoid w, MonadTime m) => MonadTime (Lazy.RWST r w s m) where
  getCurrentTime :: RWST r w s m UTCTime
getCurrentTime = m UTCTime -> RWST r w s m UTCTime
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m UTCTime
forall (m :: * -> *). MonadTime m => m UTCTime
getCurrentTime

instance (Monoid w, MonadTime m) => MonadTime (Strict.RWST r w s m) where
  getCurrentTime :: RWST r w s m UTCTime
getCurrentTime = m UTCTime -> RWST r w s m UTCTime
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m UTCTime
forall (m :: * -> *). MonadTime m => m UTCTime
getCurrentTime

instance MonadTime m => MonadTime (ContT r m) where
  getCurrentTime :: ContT r m UTCTime
getCurrentTime   = m UTCTime -> ContT r m UTCTime
forall (m :: * -> *) a. Monad m => m a -> ContT r m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m UTCTime
forall (m :: * -> *). MonadTime m => m UTCTime
getCurrentTime