File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
si-timers/src/Control/Monad/Class/MonadTimer Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ import Control.Monad (when)
30
30
#endif
31
31
import Control.Monad.Class.MonadSTM
32
32
33
+ import Control.Monad.Cont (ContT (.. ))
33
34
import Control.Monad.RWS (RWST (.. ))
34
35
import Control.Monad.Reader (ReaderT (.. ))
35
36
import Control.Monad.State (StateT (.. ))
@@ -172,6 +173,13 @@ instance MonadTimeout IO where
172
173
-- Transformer's instances
173
174
--
174
175
176
+ instance MonadTimeout m => MonadTimeout (ContT r m ) where
177
+ newtype Timeout (ContT r m ) = TimeoutC { unTimeoutC :: Timeout m }
178
+ newTimeout = lift . fmap TimeoutC . newTimeout
179
+ readTimeout = WrappedSTM . readTimeout . unTimeoutC
180
+ updateTimeout (TimeoutC t) d = lift $ updateTimeout t d
181
+ cancelTimeout = lift . cancelTimeout . unTimeoutC
182
+
175
183
instance MonadTimeout m => MonadTimeout (ReaderT r m ) where
176
184
newtype Timeout (ReaderT r m ) = TimeoutR { unTimeoutR :: Timeout m }
177
185
newTimeout = lift . fmap TimeoutR . newTimeout
You can’t perform that action at this time.
0 commit comments