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.
async
/await
syntax — this is unreleased, but see a preview here.
let (p, resolve_p) = Repromise.new_();
p
|> Repromise.map(s => s ++ ", world!")
|> Repromise.wait(print_endline);
resolve_p("Hello");
/* Prints "Hello, world!" */
npm install bs-platform
npm install @aantron/repromise
Add @aantron/repromise
to your bsconfig.json
:
{
"bs-dependencies": [
"@aantron/repromise"
]
}
We have a couple repos that show how to depend on Repromise and get started with it:
...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.
- Release native implementation.
- Release
let%await
syntax (the PPX). - Helpers for converting
Repromise.Rejectable.t
toBelt.Result.t
. - Smarter async exception handling.
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.