Skip to content

Commit

Permalink
io-sim: include readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
coot committed Sep 14, 2020
1 parent f1c2c6e commit c323384
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions io-sim/README.md
@@ -0,0 +1,35 @@
# Simulator Monad

A pure simulator monad built on top of the `ST` monad which supports:

* synchronous and asynchronous exceptions; including: throwing, catching and
masking synchronous and asynchronous exceptions;
* concurrency (using simulated threads), with interfaces shaped by the
`base` and `async` libraries;
* software transactional memory (`STM`);
* simulated time;
* timeouts;
* dynamically typed traces and event log tracing;
* lifting any `ST` computations;
* deadlock detection.

`io-sim` is a drop-in replacement for the `IO` monad. It was designed to write easily
testable Haskell networking code. Using
[io-sim-classes](https://hackage.haskell.org/package/io-sim-classes) library
one can write code that can run in both: real `IO` and the `SimM` monad. One
of the design goals was to keep the api as close as possible to `base`,
`exceptions`, `async` and `stm` packages.

As a design choice `IOSim` does not support `MVar`s by default, but they can be
simulated using `stm` interface.

`io-sim` supports both `io-sim-classes` class hierarchy and `base`
/ `exceptions` class hierarchies (they diverge in some detail).


The package contains thorough tests, including tests of `STM` against the original
specification (as described in [Composable Memory
Transactions](https://research.microsoft.com/en-us/um/people/simonpj/papers/stm/stm.pdf)
and its `GHC` implementation. This can be seen in both ways: as a check that
our implementation matches the specification and the `GHC` implementation, but also
the other way around: that `GHC`s `STM` implementation meets the specification.

0 comments on commit c323384

Please sign in to comment.