@@ -17,6 +17,12 @@ module Control.Monad.Class.MonadTime.SI
17
17
, NominalDiffTime
18
18
) where
19
19
20
+ import Control.Monad.Cont
21
+ import Control.Monad.RWS
22
+ import Control.Monad.Reader
23
+ import Control.Monad.State
24
+ import Control.Monad.Writer
25
+
20
26
import Control.Monad.Class.MonadTime ( MonadMonotonicTimeNSec ,
21
27
MonadTime (.. ), NominalDiffTime , UTCTime , diffUTCTime ,
22
28
addUTCTime )
@@ -58,3 +64,22 @@ class MonadMonotonicTimeNSec m => MonadMonotonicTime m where
58
64
conv = Time . Time. picosecondsToDiffTime . (* 1_000 ) . toInteger
59
65
60
66
instance MonadMonotonicTime IO where
67
+
68
+ --
69
+ -- MTL instances
70
+ --
71
+
72
+ instance MonadMonotonicTime m => MonadMonotonicTime (ReaderT r m ) where
73
+ getMonotonicTime = lift getMonotonicTime
74
+
75
+ instance MonadMonotonicTime m => MonadMonotonicTime (StateT s m ) where
76
+ getMonotonicTime = lift getMonotonicTime
77
+
78
+ instance (Monoid w , MonadMonotonicTime m ) => MonadMonotonicTime (WriterT w m ) where
79
+ getMonotonicTime = lift getMonotonicTime
80
+
81
+ instance (Monoid w , MonadMonotonicTime m ) => MonadMonotonicTime (RWST r w s m ) where
82
+ getMonotonicTime = lift getMonotonicTime
83
+
84
+ instance MonadMonotonicTime m => MonadMonotonicTime (ContT r m ) where
85
+ getMonotonicTime = lift getMonotonicTime
0 commit comments