Skip to content

Commit 9d771b9

Browse files
committed
Updated README.md file
1 parent f4183f2 commit 9d771b9

File tree

1 file changed

+32
-22
lines changed

1 file changed

+32
-22
lines changed

README.md

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# io-sim
22

3+
34
`IOSim` is an simulator monad which supports:
45

56
* asynchronous exceptions
@@ -9,69 +10,75 @@
910
* concurrency: both low level `forkIO` as well as `async` style
1011
* strict STM
1112
* access to lazy ST
12-
* schedule discovery (see [IOSimPOR](./how-to-use-IOSimPOR.md))
13+
* schedule discovery (see [IOSimPOR][io-sim-por-how-to])
1314
* eventlog
1415
* dynamic tracing
15-
* tracing committed changes to `TVar`, `TMVar`s, ...
16-
* labeling of threads, `TVar`'s, ...
16+
* tracing committed changes to `TVar`, `TMVar`s, etc.
17+
* labelling of threads, `TVar`'s, etc.
1718

18-
`io-classes` provide a common interface, which allow to write code which can be
19-
run in both real `IO` and `IOSim`. It is a drop-in replacement for `IO`.
19+
`io-classes` provides an interface, which allows to write code which can be run
20+
in both real `IO` and `IOSim`. It is a drop-in replacement for `IO`, and
21+
supports interfaces commonly known from `base`, `exceptions`, `stm`, `async` or
22+
`time` packages.
2023

2124
One of the principles of `io-classes` was to stay as close to `IO` as possible,
22-
thus most of the `IO` instances are directly referring to `base`, `async` api.
25+
thus most of the `IO` instances are directly referring to `base` or `async` api.
2326
However we made some differences, which are reported below.
2427

2528
`io-classes` supports a novel hierarchy for error handling monads as well more
2629
familiar `exception` style. The new hierarchy provides `bracket` and
2730
`finally` functions in the `MonadThrow` class, while `catch` style operators
2831
are provided by a super-class `MonadCatch`. Both `bracket` and `finally` are
29-
the most common interface used to write code with robust exception handling,
32+
the most common functions used to write code with robust exception handling,
3033
exposing them through the more basic `MonadThrow` class informs the reader
3134
/ reviewer that no tricky error handling is done in that section of the code
3235
base.
3336

3437
`IOSim` exposes a detailed trace, which can be enhanced by labelling threads,
3538
or mutable variables, tracing `Dynamic` values (which can be recovered from the
36-
trace) or simple `String` based tracing. It has been used to develop & test
37-
a complex concurrent system ([ouroboros-network][ouroboros-network]), in
38-
particular
39+
trace) or simple `String` based tracing. Although its agnostic with respect to
40+
the logging framework, it worked of us particularly well using
41+
[contra-tracer][contra-tracer]. It has been used to develop, test and debug
42+
a complex, highly-concurrent, distributed system
43+
([ouroboros-network][ouroboros-network]), in particular
3944

4045
* write network simulations, to verify a complex networking stack;
41-
* write disk IO simulations, to verify database solution.
46+
* write disk IO simulations, to verify a database implementation.
47+
4248

4349
## Packages
4450

45-
* `io-sim`: provides two simulator monads: `IOSim` and `IOSimPOR` - an enhanced
46-
`IOSim` version with schedule discovery capabilities.
47-
* `io-classes`: class bases interface
51+
* `io-sim`: provides two simulator interpreters: `IOSim` and `IOSimPOR` - an
52+
enhanced `IOSim` version with schedule discovery capabilities.
53+
* `io-classes`: class bases interface, which allows to to abstract over the
54+
monad
4855
* `strict-stm`: strict STM operations
4956

50-
[ouroboros-network]: https://github.com/input-output-hk/ouroboros-network
51-
5257

5358
## Differences from `base`, `async` or `exceptions` packages
5459

60+
### Major differences
61+
5562
* `threadDelay` is using `DiffTime` (which is measured in _seconds_ rather than _microseconds_).
5663
* `regiterDelay` is using `DiffTime`
5764
* `timeout` is using `DiffTime`
5865
* `getMonotonicTime` returns `Time` (a newtype wrapper around `DiffTime`)
5966

67+
6068
### Minor differences
6169

62-
Some of the types have more general type signatures, e.g.
70+
Some of the types have more general kind signatures, e.g.
6371

6472
```
6573
type Async :: (Type -> Type) -> Type -> Type
6674
```
6775

68-
The first type of kind `Type -> Type` describe the monad which could be
76+
The first type of kind `Type -> Type` describes the monad which could be
6977
instantiated to `IO`, `IOSim` or some other monad stack build with monad
7078
transformers. The same applies to many other types, e.g. `TVar`, `TMVar`.
7179

72-
The types although similar to the original
73-
are not the same as the ones that come from `base`, `async`, or
74-
`excpetions` packages:
80+
The following types although similar to the originals are not the same as the
81+
ones that come from `base`, `async`, or `excpetions` packages:
7582

7683
* `Handler` (origin: `base`)
7784
* `MaskingState` (origin: `base`)
@@ -82,12 +89,15 @@ are not the same as the ones that come from `base`, `async`, or
8289

8390
### Issues
8491

85-
Although new issues should be reported in this repository, we still have a list
92+
New issues should be reported in this repository, we still have a list
8693
of issues opened in the `ouroboros-network` repository:
8794

8895
* [io-sim issues][io-sim-issues]
8996
* [io-classes issues][io-sim-issues]
9097

98+
[io-sim-por-how-to]: ./io-sim/how-to-use-IOSimPOR.md
9199
[ouroboros-network]: https://github.com/input-output-hk/ouroboros-network
92100
[io-sim-issues]: https://github.com/input-output-hk/ouroboros-network/issues?q=is%3Aopen+is%3Aissue+label%3Aio-sim
93101
[io-classes-issues]: https://github.com/input-output-hk/ouroboros-network/issues?q=is%3Aopen+is%3Aissue+label%3Aio-classes
102+
[contra-tracer]: https://hackage.haskell.org/package/contra-tracer
103+
[io-sim-por]: https://github.com/input-output-hk/io-sim/blob/main/io-sim/how-to-use-IOSimPOR.md

0 commit comments

Comments
 (0)