Skip to content

Commit 2c8049d

Browse files
committed
chore: update README
1 parent 7d81014 commit 2c8049d

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
# Promise     [![NPM link][npm-img]][npm] [![Travis status][travis-img]][travis] [![Coverage][coveralls-img]][coveralls]
44

5-
[npm]: https://www.npmjs.com/package/reason-promise
6-
[npm-img]: https://img.shields.io/npm/v/reason-promise
5+
[npm]: https://www.npmjs.com/package/@dck/rescript-promise
6+
[npm-img]: https://img.shields.io/npm/v/@dck/rescript-promise
77
[travis]: https://travis-ci.org/aantron/promise/branches
88
[travis-img]: https://img.shields.io/travis/aantron/promise/master.svg?label=travis
99
[coveralls]: https://coveralls.io/github/aantron/promise?branch=master
@@ -22,18 +22,18 @@ Promise.resolved("Hello")
2222
As you can see on the first line, `Promise.t` maps directly to familiar JS
2323
promises from your JS runtime. That means...
2424

25-
- You can use `reason-promise` directly to [write JS bindings](#Bindings).
26-
- All JS tooling for promises immediately works with `reason-promise`.
25+
- You can use `@dck/rescript-promise` directly to [write JS bindings](#Bindings).
26+
- All JS tooling for promises immediately works with `@dck/rescript-promise`.
2727
- Even if you do something exotic, like switch out the promise implementation at
28-
the JS level, for, say, better stack traces, `reason-promise` still binds to
28+
the JS level, for, say, better stack traces, `@dck/rescript-promise` still binds to
2929
it!
3030

3131
<br/>
3232

3333
There is only one exception to the rule that `Promise.t` maps directly to JS
3434
promises: when there is a promise nested inside another promise. JS [breaks the
3535
type safety](#JSPromiseFlattening) of promises in a misguided attempt to
36-
disallow nesting. [`reason-promise` instead emulates it in a way that makes
36+
disallow nesting. [`@dck/rescript-promise` instead emulates it in a way that makes
3737
promises type-safe again](#TypeSafety). This is in contrast to BuckleScript's
3838
built-in `Js.Promise`, which directly exposes the JS behavior, and so is not
3939
type-safe.
@@ -42,10 +42,10 @@ type-safe.
4242

4343
In addition:
4444

45-
- `reason-promise` offers a clean functional API, which replaces rejection with
45+
- `rescript-promise` offers a clean functional API, which replaces rejection with
4646
[helpers for `Result` and `Option`](#Errors).
47-
- `reason-promise` is tiny. It weighs in at about [1K bundled][bundle-size].
48-
- `reason-promise` also has a full, standalone [pure-OCaml
47+
- `rescript-promise` is tiny. It weighs in at about [1K bundled][bundle-size].
48+
- `rescript-promise` also has a full, standalone [pure-OCaml
4949
implementation][native], which passes all the same tests. It can be used for
5050
native code or in JS.
5151

@@ -67,7 +67,7 @@ In addition:
6767
- [**Advanced: Rejection**](#Rejection)
6868
- [**Advanced: Bindings**](#Bindings)
6969
- [**Discussion: Why JS promises are unsafe**](#JSPromiseFlattening)
70-
- [**Discussion: How `reason-promise` makes promises type-safe**](#TypeSafety)
70+
- [**Discussion: How `rescript-promise` makes promises type-safe**](#TypeSafety)
7171

7272
<br/>
7373

@@ -76,14 +76,14 @@ In addition:
7676
### Installing
7777

7878
```
79-
npm install reason-promise
79+
npm install @dck/rescript-promise
8080
```
8181

82-
Then, add `reason-promise` to your `bsconfig.json`:
82+
Then, add `@dck/rescript-promise` to your `rescript.json`:
8383

8484
```json
8585
{
86-
"bs-dependencies": ["reason-promise"]
86+
"bs-dependencies": ["@dck/rescript-promise"]
8787
}
8888
```
8989

@@ -581,7 +581,7 @@ directly, safely be used from ReScript.
581581

582582
<a id="TypeSafety"></a>
583583

584-
### Discussion: How `reason-promise` makes promises type-safe
584+
### Discussion: How `@dck/rescript-promise` makes promises type-safe
585585

586586
The [previous section](#JSPromiseFlattening) shows that JS promise functions are
587587
broken. An important observation is that it is only the _functions_ that are
@@ -591,14 +591,14 @@ safe replacement functions to use with it in ReScript. This is good news
591591
for interop :)
592592

593593
To fix the functions, only the [special-case flattening](#JSPromiseFlattening)
594-
has to be undone. So, when you call `reason-promise`'s
594+
has to be undone. So, when you call `@dck/rescript-promise`'s
595595
[`Promise.resolved(value)`][resolved], it checks whether `value` is a promise
596596
or not, and...
597597

598-
- If `value` _is not_ a promise, `reason-promise` just passes it to JS's
598+
- If `value` _is not_ a promise, `@dck/rescript-promise` just passes it to JS's
599599
[`Promise.resolve`][Promise.resolve], because JS will do the right thing.
600600
- If `value` _is_ a promise, it's not safe to simply pass it to JS, because it
601-
will trigger the special-casing. So, `reason-promise` boxes the nested
601+
will trigger the special-casing. So, `@dck/rescript-promise` boxes the nested
602602
promise:
603603

604604
```rescript
@@ -612,17 +612,17 @@ or not, and...
612612
enough to suppress the special-casing.
613613

614614
Whenever you try to take the value out of this resulting structure (for
615-
example, by calling [`Promise.get`][get] on it), `reason-promise`
615+
example, by calling [`Promise.get`][get] on it), `@dck/rescript-promise`
616616
transparently unboxes the `PromiseBox` and passes the nested promise to your
617617
callback &mdash; as your callback would expect.
618618

619-
This conditional boxing and unboxing is done throughout `reason-promise`. It
619+
This conditional boxing and unboxing is done throughout `@dck/rescript-promise`. It
620620
only happens for nested promises, and anything else with a `.then` method. For
621-
all other values, `reason-promise` behaves, internally, exactly like JS
621+
all other values, `@dck/rescript-promise` behaves, internally, exactly like JS
622622
`Promise` (though with a cleaner outer API). This is enough to make promises
623623
type-safe.
624624

625-
This is a simple scheme, but `reason-promise` includes a very thorough
625+
This is a simple scheme, but `@dck/rescript-promise` includes a very thorough
626626
[test suite][tests] to be extra sure that it always manages the boxing
627627
correctly.
628628

0 commit comments

Comments
 (0)