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
{{ message }}
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.
I've been exploring control.async and data.task as a way of encapsulating promises into tasks so that promises are not executed until I call fork(..). I find this concept very useful, much like the use of IO to encapsulate code that causes side effects.
Trying out some simple examples, it seems to me that fromPromise executes the promise immediately. This is not fromPromise's fault, but rather that new Promise(..) is not lazy; it does not wait until the call to then before executing the code.
One way around this might be to add something along the lines of a fromPromiseFn function:
Then, instead of using fromPromise(readFile(filename)), you'd use fromPromiseFn(readFile, filename) to defer the creation of the Promise until fork(..) gets called.
What do you think?
Thanks again!
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi there! Thank you for this awesome library!
I've been exploring control.async and data.task as a way of encapsulating promises into tasks so that promises are not executed until I call
fork(..)
. I find this concept very useful, much like the use of IO to encapsulate code that causes side effects.Trying out some simple examples, it seems to me that
fromPromise
executes the promise immediately. This is notfromPromise
's fault, but rather thatnew Promise(..)
is not lazy; it does not wait until the call tothen
before executing the code.One way around this might be to add something along the lines of a
fromPromiseFn
function:Then, instead of using
fromPromise(readFile(filename))
, you'd usefromPromiseFn(readFile, filename)
to defer the creation of the Promise untilfork(..)
gets called.What do you think?
Thanks again!
The text was updated successfully, but these errors were encountered: