1
- # IO Monad Class Hierarchy: ` io-classes `
1
+ # IO Monad Class Hierarchy: ` io-classes ` package
2
2
3
3
This package provides a monad class hierarchy which is an interface for both
4
4
the [ ` io-sim ` ] and [ ` IO ` ] monads. It was developed with the following
@@ -21,7 +21,7 @@ We provide also non-standard extensions of this API in **sublibraries**:
21
21
microseconds represented as ` Int ` as in ` base ` )
22
22
- cancellable timeouts.
23
23
24
- * [ ` io-classes:io-classes- mtl ` ] ( https://input-output-hk.github.io/io-sim/io-classes/io-classes- mtl/index.html ) :
24
+ * [ ` io-classes:mtl ` ] ( https://input-output-hk.github.io/io-sim/io-classes/mtl/index.html ) :
25
25
MTL instances.
26
26
27
27
[ ` io-classes:strict-stm ` ] ( https://input-output-hk.github.io/io-sim/io-classes/strict-stm/index.html )
@@ -63,6 +63,8 @@ in [`si-timers`] (ref [SI]), which provides a monoidal action of `DiffTime` on
63
63
monotonic time as well as exposes 32-bit safe timer API (on 32-bit systems time
64
64
in microseconds represented as an ` Int ` can only hold timeouts of ~ 35 minutes).
65
65
66
+ [ ` si-timers ` ] sublibrary provides cancellable timers API, see [ ` registerDelayCancellable ` ] .
67
+
66
68
` Control.Monad.Class.MonadTimer.NonStandard.MonadTimeout ` provides a low-level
67
69
timeout abstraction. On systems that support a native timer manager, it's used
68
70
to implement its API, which is very efficient even for low-latency timeouts.
@@ -77,17 +79,22 @@ delays & timers.
77
79
78
80
## Software Transactional Memory API
79
81
80
- We provide two interfaces to ` stm ` API: lazy, included in ` io-classes ` ; and
82
+ We provide two interfaces to ` stm ` API: lazy, included in [ ` io-classes ` ] [ lazy-stm ] ; and
81
83
strict one provided by [ ` io-classes:strict-stm ` ] ( https://input-output-hk.github.io/io-sim/io-classes/strict-stm/index.html ) .
82
84
83
85
## Threads API
84
86
85
87
We draw a line between ` base ` API and ` async ` API. The former is provided by
86
- [ MonadFork] ( https://hackage.haskell.org/package/io-classes/docs/Control-Monad-Class-MonadFork.html#t:MonadFork )
87
- the latter by
88
- [ MonadAsync] ( https://hackage.haskell.org/package/io-classes/docs/Control-Monad-Class-MonadAsync.html#t:MonadAsync ) .
89
- Both are shallow abstractions around APIs exposed by the ` base ` and ` async `
90
- packages.
88
+ [ MonadFork] the latter by
89
+ [ MonadAsync] Both are shallow abstractions around APIs exposed by the ` base `
90
+ and ` async ` packages.
91
+
92
+ ## ` MVar ` API
93
+
94
+ We also provide lazy and strict ` MVar ` s:
95
+
96
+ * [ lazy ` MVar ` ] [ MonadMVar ] API
97
+ * [ strict ` MVar ` ] [ strict-mvar ] API is provided in the [ io-classes: strict-mvar ] sublibrary.
91
98
92
99
93
100
## Some other APIs
@@ -96,6 +103,14 @@ packages.
96
103
* [ MonadST] [ MonadST ] : provides a way to lift ` ST ` -computations.
97
104
* [ MonadSay] [ MonadSay ] : dummy debugging interface
98
105
106
+
107
+ ## Monad Transformers
108
+
109
+ We provide support for monad transformers, see [ io-classes: mtl ] sublibrary.
110
+ Although at this stage it might have its limitations and so there might be some
111
+ rough edges. PRs are welcomed, [ contributing] .
112
+
113
+
99
114
## Differences from ` base ` , ` async ` , or ` exceptions ` packages
100
115
101
116
### Major differences
@@ -142,22 +157,17 @@ only possible because we can control the execution environment of [`io-sim`].
142
157
* ` MonadInspectSTM ` which allows inspecting values of ` STM ` mutable variables
143
158
when they are committed. ([ ` io-sim ` ] , not provided by ` GHC ` ).
144
159
145
-
146
- ## Monad Transformers
147
-
148
- We provide support for monad transformers (although at this stage it might have
149
- its limitations and so there might be some rough edges. PRs are welcomed,
150
- [ contributing] ).
151
-
152
160
[ SI] : https://www.wikiwand.com/en/International_System_of_Units
153
161
[ `DiffTime` ] : https://hackage.haskell.org/package/time-1.10/docs/Data-Time-Clock.html#t:DiffTime
154
162
[ `IO` ] : https://hackage.haskell.org/package/base-4.14.0.0/docs/GHC-IO.html#t:IO
155
163
[ `async` ] : https://hackage.haskell.org/package/async
156
164
[ `base` ] : https://hackage.haskell.org/package/base
157
165
[ `exceptions` ] : https://hackage.haskell.org/package/exceptions
158
166
[ `io-sim` ] : https://hackage.haskell.org/package/io-sim
167
+ [ io-classes:strict-mvar ] : https://input-output-hk.github.io/io-sim/io-classes/strict-mvar/index.html
159
168
[ io-classes:mtl ] : https://input-output-hk.github.io/io-sim/io-classes/mtl/index.html
160
169
[ `stm` ] : https://hackage.haskell.org/package/stm
170
+ [ lazy-stm ] : https://input-output-hk.github.io/io-sim/io-classes/Control-Concurrent-Class-MonadSTM.html
161
171
[ `threadDelay` ] : https://hackage.haskell.org/package/io-classes/docs/Control-Monad-Class-MonadTimer.html#v:threadDelay
162
172
[ `time` ] : https://hackage.haskell.org/package/time
163
173
[ contributing ] : https://www.github.com/input-output-hk/io-sim/tree/master/CONTRIBUTING.md
@@ -167,6 +177,11 @@ its limitations and so there might be some rough edges. PRs are welcomed,
167
177
168
178
[ MonadEventlog ] : https://input-output-hk.github.io/io-sim/io-classes/Control-Monad-Class-MonadEventlog.html#t:MonadEventlog
169
179
[ Debug.Trace ] : https://hackage.haskell.org/package/base/docs/Debug-Trace.html
180
+ [ MonadAsync ] : https://input-output-hk.github.io/io-sim/io-classes/Control-Monad-Class-MonadAsync.html#t:MonadAsync
181
+ [ MonadFork ] : https://input-output-hk.github.io/io-sim/io-classes/Control-Monad-Class-MonadFork.html#t:MonadFork
182
+ [ MonadMVar ] : https://input-output-hk.github.io/io-sim/io-classes/Control-Concurrent-Class-MonadMVar.html#t:MonadMVar
183
+ [ `registerDelayCancellable` ] : http://input-output-hk.github.io/io-sim/io-classes/si-timers/Control-Monad-Class-MonadTimer-SI.html#v:registerDelayCancellable
184
+ [ strict-mvar ] : https://input-output-hk.github.io/io-sim/io-classes/strict-mvar/Control-Concurrent-Class-MonadMVar-Strict.html
170
185
[ MonadST ] : https://input-output-hk.github.io/io-sim/io-classes/Control-Monad-Class-MonadST.html#t:MonadST
171
186
[ MonadSay ] : https://input-output-hk.github.io/io-sim/io-classes/Control-Monad-Class-MonadSay.html#t:MonadSay
172
187
[ io-classes-haddocks ] : https://input-output-hk.github.io/io-sim
0 commit comments