diff --git a/README.md b/README.md index 7314210..2dc8c93 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ in a purely declarative way without actually running side-effects. * [Installation](#installation) * [Tutorial](#tutorial) +* [API](#api) * [Contributing](#contributing) ## Features @@ -257,6 +258,40 @@ throw because our implementation passes a string to `sendMessage` that mentions `10` instead of `5`. Therefore `testIO` will throw and our test will fail. +## API + +### `IO.of(a: A): IO` + +Converts any value into a IO that will return that value. + +### `withEffects((...args) => A): IO` + +Converts an impure function into an `IO` + +### `withEffectsP(p: Promise): IO` + +Converts a Promise into an `IO` + +### `throwE(error: any): IO` + +Once an error is `yield`ed the rest of the computation isn't being +run. The resulting `IO` value will produce an error instead of a +value. + +### `catchE(errorHandler: (error: any) => IO, io: IO): IO` + +As its first argument it takes a +error function handling. As its second argument it takes an `IO` +computation. It returns a new `IO` computation. + +### `testIO(e: IO, arr: any[], a: A): void` + +The first argument to `testIO` is the IO-action to test. The second is +a list of pairs. The first element in each pair is an IO-action that +the code should attempt to perform, the second element is the value +that performing the action should return. The last argument is the +expected result of the entire computation. + ## Contributing Contributions are very welcome. Development happens as follows: