TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Composability: From Callbacks to Categories in ES6

113 pointsby alrex021almost 9 years ago

8 comments

lmeyerovalmost 9 years ago
Interesting: as far as I can, this is promises, except there is a final strictness point at the end of the composition. That is, in turn, analogous to a one-shot form of old FRP formulations, where there is a final strictness&#x2F;execute call. We already see that in JS libraries, like &#x27;subscribe&#x27; in Rx: <a href="https:&#x2F;&#x2F;github.com&#x2F;Reactive-Extensions&#x2F;RxJS&#x2F;blob&#x2F;master&#x2F;doc&#x2F;api&#x2F;core&#x2F;operators&#x2F;subscribe.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Reactive-Extensions&#x2F;RxJS&#x2F;blob&#x2F;master&#x2F;doc&#x2F;...</a><p>FWIW, I&#x27;m actually not that thrilled about this sort of deferred approach. In Rx, that is part of the reason &#x27;hot&#x27; vs &#x27;cold&#x27; documentation has to exist, and I&#x27;ve seen many people struggle with it in theory &amp; practice.
评论 #12064912 未加载
评论 #12064776 未加载
评论 #12065867 未加载
评论 #12065950 未加载
girvoalmost 9 years ago
As you start to look at these concepts, and Ramda, I highly recommend playing with ramda-fantasy[0] and the fantasy-land[1] spec that it implements. Super useful, and really made this sort of functional programming &quot;click&quot; for me (and, has really cleaned up some abstractions in a couple production projects, too!)<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;ramda&#x2F;ramda-fantasy" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ramda&#x2F;ramda-fantasy</a><p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;fantasyland&#x2F;fantasy-land" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;fantasyland&#x2F;fantasy-land</a>
评论 #12065053 未加载
naileralmost 9 years ago
Note his call back hell is exacerbated by the unnecessary &#x27;else&#x27; after checking for errors and returning.<p>I&#x27;m not sure that .bindTo() chaining reads any better than .then() chaining or async.waterfall().
评论 #12064703 未加载
评论 #12064970 未加载
shakibaalmost 9 years ago
Looks like a new hell!
评论 #12064792 未加载
joostdevriesalmost 9 years ago
I was recently thinking while working with ES6 Promises that I liked to have something equivalent to Haskells `do` notation. Or Scalas `for` comprehension.<p>Does something like that exist?<p>If not maybe I should try Kleislis instead. But I&#x27;d like my code to be accessible for my colleagues. And it&#x27;s my rule of thumb that I try not to use point free constructions (like Kleislis) because a lot of colleagues will no longer understand my code easily.
评论 #12065874 未加载
jacinaboxalmost 9 years ago
The article didn&#x27;t really sell that arrows have an advantage over monads as far as callbacks are concerned.
评论 #12072240 未加载
spraakalmost 9 years ago
Really fun read!
dozziealmost 9 years ago
Arent you guys around JavaScript tired of changing your programming paradigm every half a year?
评论 #12065513 未加载