File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 9
9
` io-sim ` , since the underlying monad is ` ST ` . ` IO ` has no underlying monad, so
10
10
the provided instance for ` IO ` defaults ` inspectMVar ` to ` tryReadMVar ` .
11
11
12
+ * Add some Haddock documentation to ` MonadDelay `
13
+
12
14
## 1.1.0.0
13
15
14
16
### Breaking changes
Original file line number Diff line number Diff line change 4
4
{-# LANGUAGE ScopedTypeVariables #-}
5
5
{-# LANGUAGE TypeFamilies #-}
6
6
7
+ -- | Provides classes to handle delays and timeouts.
7
8
module Control.Monad.Class.MonadTimer
8
9
( MonadDelay (.. )
9
10
, MonadTimer (.. )
@@ -18,13 +19,22 @@ import Control.Monad.Trans (lift)
18
19
19
20
import qualified System.Timeout as IO
20
21
22
+ -- | A typeclass to delay current thread.
21
23
class Monad m => MonadDelay m where
24
+
25
+ -- | Suspends the current thread for a given number of microseconds
26
+ -- (GHC only).
27
+ --
28
+ -- See `IO.threadDelay`.
22
29
threadDelay :: Int -> m ()
23
30
31
+ -- | A typeclass providing utilities for /timeouts/.
24
32
class (MonadDelay m , MonadSTM m ) => MonadTimer m where
25
33
34
+ -- | See `STM.registerDelay`.
26
35
registerDelay :: Int -> m (TVar m Bool )
27
36
37
+ -- | See `IO.timeout`.
28
38
timeout :: Int -> m a -> m (Maybe a )
29
39
30
40
--
You can’t perform that action at this time.
0 commit comments