emacs-promise
emacs-promise copied to clipboard
[Feature Request] anamorphic version of the functions in the spirit of dash
Here it is how it will look like:
(promise-chain (do-something-async 1 33)
(thena (message "first result: %s" result)
(do-something-async 1 (* result 2)))
(thena (message "second result: %s" result)
(do-something-async 1 (* result 2)))
(thena (message "third result: %s" result)))
Unfortunately, I can't find a better way to writethen
as suggested, since it takes two functions as arguments, as shown below.
(promise-chain (do-something-async 1 33)
(then (lambda (value)
(message "value -> %s" value))
(lambda (reason)
(message "error: reason -> %s" reason))))
Hh, can we use thena
only for the positive case and let catcha
handle the error? Does this make any sense?
(promise-chain (do-something-async 1 33)
(thena (message "result -> %s" result))
(catcha (message "error: reason -> %s" error)))
I've added an anaphoric version!