Skip to content

Commit 38222f6

Browse files
authored
Merge pull request #116 from abailly-iohk/abailly-iohk/document-monad-delay
Provide minimal haddock comments for MonadDelay
2 parents 892076e + 66d2e7e commit 38222f6

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

io-classes/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
`io-sim`, since the underlying monad is `ST`. `IO` has no underlying monad, so
1010
the provided instance for `IO` defaults `inspectMVar` to `tryReadMVar`.
1111

12+
* Add some Haddock documentation to `MonadDelay`
13+
1214
## 1.1.0.0
1315

1416
### Breaking changes

io-classes/src/Control/Monad/Class/MonadTimer.hs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
{-# LANGUAGE ScopedTypeVariables #-}
55
{-# LANGUAGE TypeFamilies #-}
66

7+
-- | Provides classes to handle delays and timeouts.
78
module Control.Monad.Class.MonadTimer
89
( MonadDelay (..)
910
, MonadTimer (..)
@@ -18,13 +19,22 @@ import Control.Monad.Trans (lift)
1819

1920
import qualified System.Timeout as IO
2021

22+
-- | A typeclass to delay current thread.
2123
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`.
2229
threadDelay :: Int -> m ()
2330

31+
-- | A typeclass providing utilities for /timeouts/.
2432
class (MonadDelay m, MonadSTM m) => MonadTimer m where
2533

34+
-- | See `STM.registerDelay`.
2635
registerDelay :: Int -> m (TVar m Bool)
2736

37+
-- | See `IO.timeout`.
2838
timeout :: Int -> m a -> m (Maybe a)
2939

3040
--

0 commit comments

Comments
 (0)