@rejs/re-future

0.2.3 • Public • Published

re-future

npm version Build Status Coverage Status Known Vulnerabilities

ReasonML library to provide Future and ResultFuture monads as an alternative to Js.Promise.

The Future is the most simple unit of evaluable value which can resolve at some point in the future. ResultFuture is a future that eventually contains Belt.Result.t result inside. This is the most useful replacement for Js.Promise because Js.Promise also contains the possibility of resolving to Ok value or rejection to Error value.

Special focus has been given to provide complete and yet compact set of utility functions to work with both Future and ResultFuture entities. Besides test coverage this library also contains a very basic memory performance test to ensure that memory gets freed (garbage collected) when Future has used the binded functions and evaluation is done.

Install

npm install @rejs/re-future

Edit to bsconfig.json:

"bs-dependencies": [..., "@rejs/re-future", ...],

This library is namespaced; to simplify access do:

module ResultFuture = RejsReFuture.ResultFuture;
// or
open RejsReFuture;

Or you can open globally in your bsconfig.json:

"bsc-flags": [ "-open RejsReFuture" ]

SDK Documentation and Examples

More usage examples also in the __tests__/

The most compact references of Future and ResultFuture are the interface files:

Package Sidebar

Install

npm i @rejs/re-future

Weekly Downloads

0

Version

0.2.3

License

MIT

Unpacked Size

21 kB

Total Files

8

Last publish

Collaborators

  • seprich