@aantron/repromisedeprecated

Type-safe JS promises for ReasonML

Usage no npm install needed!

<script type="module">
  import aantronRepromise from 'https://cdn.skypack.dev/@aantron/repromise';
</script>

README

Repromise    Version 0.6.1 Travis status

Repromise is a binding to JS promises, with:

  • Interop — each Repromise is a JS promise, so JS libraries that return promises already return Repromises, and existing JS tooling should work.
  • Type safety — Repromises nest, and don't "collapse" like JS promises.
  • Explicit errors — no baked-in reject or exception handling, so you can choose how to handle errors.
  • Minimal code — the compiled repromise.js compresses to about 1K.
  • Native support — Repromise also has a pure-Reason implementation, which compiles to native code.

let (p, resolve_p) = Repromise.make();

p
|> Repromise.map(s => s ++ ", world!")
|> Repromise.wait(print_endline);

resolve_p("Hello");

/* Prints "Hello, world!" */

Installing

npm install bs-platform
npm install @aantron/repromise

Add @aantron/repromise to your bsconfig.json:

{
  "bs-dependencies": [
    "@aantron/repromise"
  ]
}

Sample projects

We have a couple repos that show how to depend on Repromise and get started with it:


Docs

...are online!

To begin, we recommend looking at the "Hello, world!" project, and then reading the API docs. Starting from wait, each function has examples. You can paste them into the "Hello, world!" project to play around with Repromise.

The Design FAQ gives some background about Repromise.

To learn how to write bindings, we suggest starting with the node-fetch project, then reading the Interop docs, and perhaps the rejectable API docs.


Roadmap


Contact

Please don't hesitate to open an issue, or come bug us on Discord. All questions, feedback, and bikeshedding are welcome :)

Repromise is at a pretty early stage of development, and we can change just about everything.