-
Notifications
You must be signed in to change notification settings - Fork 396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passing arguments into resolver when calling when.promise(r) #445
Comments
Hey @markbjerke, I'm trying to get my head around this :) Can you help me out with a more complete code example of what you mean? Thanks! |
Ping @markbjerke. I'm still trying to understand what you mean here. Can you add a more complete example? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I want when.lift(f) but that returns a (thenable) object with an execute method. The object could even be an extension of a Promise, for maximum leverage but it's not important overall.
Something like: p(r) = when.task( r ); p.execute(....), p.then(...) where p(r) is a theable with a way to execute r(args); e.g. p.execute(args), on demand.
I was thinking of writing a factory method and extending when.Promise, since a function amplified with a record is a (future) unit of work that can be, named, composed etc..
With when.lift(f) , you get back a promisified fn. Even though I can merge properties on a function it seems awkward although with javascript that is more the perception then the reality perhaps 👍
g = when.lift(f) t = _.merge(g, {config}); g( args ); g as record;
if we had a flavor of when.lift, that returned an object with an execute method, it would be more reasonable to think of a lifted function as a deferred resolver as a record that has a an execute method. There is a writer monad in Haskell for instance that is similiar.
Is there room for this idea in a Promise library, and is there anything to gain from making the above ideas standardized ?
thanks
mark bjerke
The text was updated successfully, but these errors were encountered: