@@ -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 )
@@ -56,3 +62,22 @@ class MonadMonotonicTimeNSec m => MonadMonotonicTime m where
56
62
conv = Time . Time. picosecondsToDiffTime . (* 1_000 ) . toInteger
57
63
58
64
instance MonadMonotonicTime IO where
65
+
66
+ --
67
+ -- MTL instances
68
+ --
69
+
70
+ instance MonadMonotonicTime m => MonadMonotonicTime (ReaderT r m ) where
71
+ getMonotonicTime = lift getMonotonicTime
72
+
73
+ instance MonadMonotonicTime m => MonadMonotonicTime (StateT s m ) where
74
+ getMonotonicTime = lift getMonotonicTime
75
+
76
+ instance (Monoid w , MonadMonotonicTime m ) => MonadMonotonicTime (WriterT w m ) where
77
+ getMonotonicTime = lift getMonotonicTime
78
+
79
+ instance (Monoid w , MonadMonotonicTime m ) => MonadMonotonicTime (RWST r w s m ) where
80
+ getMonotonicTime = lift getMonotonicTime
81
+
82
+ instance MonadMonotonicTime m => MonadMonotonicTime (ContT r m ) where
83
+ getMonotonicTime = lift getMonotonicTime
0 commit comments