Comparing version 12.0.0-beta.0 to 12.0.0-beta.1
@@ -125,3 +125,3 @@ declare module 'fluture' { | ||
/** Fold both branches into the resolution branch. See https://github.com/fluture-js/Fluture#fold */ | ||
export function fold<LA, RA, LB, RB>(lmapper: (left: LA) => RA): (rmapper: (right: RA) => RB) => (source: FutureInstance<LA, RA>) => FutureInstance<LB, RB> | ||
export function fold<LA, RA, LB, RB>(lmapper: (left: LA) => RB): (rmapper: (right: RA) => RB) => (source: FutureInstance<LA, RA>) => FutureInstance<LB, RB> | ||
@@ -171,3 +171,3 @@ /** Fork the given Future into the given continuations. See https://github.com/fluture-js/Fluture#fork */ | ||
/** Convert a Future to a Promise. See https://github.com/fluture-js/Fluture#promise */ | ||
export function promise<R>(source: FutureInstance<any, R>): Promise<R> | ||
export function promise<R>(source: FutureInstance<Error, R>): Promise<R> | ||
@@ -174,0 +174,0 @@ /** Race two Futures against one another. See https://github.com/fluture-js/Fluture#race */ |
12
index.js
@@ -1170,4 +1170,4 @@ (function (global, factory) { | ||
return function done(m){ | ||
var context2 = application(2, done, future, m, context1); | ||
return m._interpret(raise, callback, done$res, context2); | ||
application(2, done, future, m, context1); | ||
return m._interpret(raise, callback, done$res); | ||
}; | ||
@@ -1421,6 +1421,6 @@ } | ||
var LastlyTransformation = createTransformation(1, 'lastly', { | ||
rejected: function FinallyAction$rejected(x){ | ||
rejected: function LastlyAction$rejected(x){ | ||
return this.$1._transform(new AndTransformation(this.context, new Reject(this.context, x))); | ||
}, | ||
resolved: function FinallyAction$resolved(x){ | ||
resolved: function LastlyAction$resolved(x){ | ||
return this.$1._transform(new AndTransformation(this.context, new Resolve(this.context, x))); | ||
@@ -1534,5 +1534,5 @@ } | ||
function promise(m){ | ||
var context1 = application1(promise, future, m); | ||
application1(promise, future, m); | ||
return new Promise(function promise$computation(res, rej){ | ||
m._interpret(raise, rej, res, context1); | ||
m._interpret(rej, rej, res); | ||
}); | ||
@@ -1539,0 +1539,0 @@ } |
{ | ||
"name": "fluture", | ||
"version": "12.0.0-beta.0", | ||
"version": "12.0.0-beta.1", | ||
"description": "FantasyLand compliant (monadic) alternative to Promises", | ||
@@ -88,4 +88,4 @@ "main": "index", | ||
"typescript": "^3.0.3", | ||
"xyz": "^3.0.0" | ||
"xyz": "github:davidchambers/xyz#bee6fbe" | ||
} | ||
} |
@@ -50,3 +50,3 @@ # [![Fluture](logo.png)](#butterfly) | ||
> `npm install --save fluture` | ||
> `npm install --save fluture@beta` | ||
@@ -103,3 +103,3 @@ On older environments you may need to polyfill one or more of the following | ||
Fluture is hosted in full with all of its dependencies at | ||
https://cdn.jsdelivr.net/gh/fluture-js/Fluture@12.0.0-beta.0/dist/bundle.js | ||
https://cdn.jsdelivr.net/gh/fluture-js/Fluture@12.0.0-beta.1/dist/bundle.js | ||
@@ -247,3 +247,4 @@ This script will add `Fluture` to the global scope. | ||
- **ConcurrentFuture** - [Concurrified][concurrify] Futures ([`Future.Par`](#concurrentfuture)). | ||
- **Promise** - Values which conform to the [Promises/A+ specification][7]. | ||
- **Promise a b** - Values which conform to the [Promises/A+ specification][7] | ||
and have a rejection reason of type `a` and a resolution value of type `b`. | ||
- **Nodeback a b** - A Node-style callback; A function of signature `(a | Nil, b) -> x`. | ||
@@ -612,3 +613,3 @@ - **Pair a b** - An array with exactly two elements: `[a, b]`. | ||
```hs | ||
attemptP :: (Undefined -> Promise e r) -> Future e r | ||
attemptP :: (Undefined -> Promise a b) -> Future a b | ||
``` | ||
@@ -1109,3 +1110,3 @@ | ||
```hs | ||
promise :: Future a b -> Promise b a | ||
promise :: Future Error a -> Promise Error a | ||
``` | ||
@@ -1118,8 +1119,7 @@ | ||
If an exception was encountered during the computation, it will be thrown. | ||
If an exception was encountered during the computation, the promise will reject | ||
with it. I recommend using [`fold`](#fold) before `promise` to ensure that | ||
exceptions and rejections are not mixed into the Promise rejection branch. | ||
This is a convenience function which provides a "quick and dirty" way to create | ||
a Promise from a Future. You should only use it in scenarios where you're not | ||
interested in [cancellation](#cancellation), nor interested in recovering from | ||
exceptions. For example in a test runner that wants you to give it a Promise. | ||
Cancellation capabilities are lost when using `promise` to consume the Future. | ||
@@ -1129,2 +1129,5 @@ ```js | ||
[resolution]: 42 | ||
> promise (reject ('failure')) .then (log ('resolution'), log ('rejection')) | ||
[rejection]: "failure" | ||
``` | ||
@@ -1131,0 +1134,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1518
168939
3196