You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Promises and Futures are pretty similar, with two major exceptions: Futures have a case for "the computation was cancelled", and they allow you to have futures of futures. Other than that, they're pretty much the same, so it makes sense to be able to convert between them easily.
Due to the limitation of promises, the following design decisions should be considered:
When converting a Future to a Promise, a Cancellation becomes an errored promise with a special Cancellation object. This object should be available to the user so they can check if a Promise contains a cancellation error.
Where does this go?
In the data/conversions module, as both promiseToFuture and futureToPromise.
In the data/future module, as both toPromise (an instance method), and fromPromise (a module-level function).
Refer to existing data/conversions modules, and the from* and to* functions in data/maybe and data/either to see more or less how this is done.
The text was updated successfully, but these errors were encountered:
Promises and Futures are pretty similar, with two major exceptions: Futures have a case for "the computation was cancelled", and they allow you to have futures of futures. Other than that, they're pretty much the same, so it makes sense to be able to convert between them easily.
This means we'd have two basic functions:
Due to the limitation of promises, the following design decisions should be considered:
Cancellation
object. This object should be available to the user so they can check if a Promise contains a cancellation error.Where does this go?
In the
data/conversions
module, as bothpromiseToFuture
andfutureToPromise
.In the
data/future
module, as bothtoPromise
(an instance method), andfromPromise
(a module-level function).Refer to existing
data/conversions
modules, and thefrom*
andto*
functions indata/maybe
anddata/either
to see more or less how this is done.The text was updated successfully, but these errors were encountered: