Twitter | Search | |
Sebastian Markbåge
Poor man's algebraic effects.
SynchronousAsync.js. GitHub Gist: instantly share code, notes, and snippets.
GitHub GitHub @github
Reply Retweet Like More
Daniel Hillerström 16 Jan 18
Replying to @sebmarkbage
Firstly, I quite like your work. Secondly, I'd argue this has very little to do with algebraic effects and their handlers. There are no abstract operations. The interpretation of `fetchTextSync` is given directly in its body rather by the handler `runPureTask`, i.e. no modularity
Reply Retweet Like
Sebastian Markbåge 16 Jan 18
Replying to @dhillerstrom @acdlite
This is a good point. My thinking was that it would be more convenient given current APIs/ecosystem but it is also causing some confusion about what you're allowed to do there. Might be better to, for example, throw a function that in turn can return a Promise. cc
Reply Retweet Like
Jamie Dixon 14 Dec 17
Replying to @sebmarkbage
Can you explain more about the “throw” syntax used here and how that works please?
Reply Retweet Like
Sebastian Markbåge 14 Dec 17
Replying to @jamiedixon
There is no new syntax. This is just JS. If data isn’t not a cache it throws a promise object and retries later.
Reply Retweet Like
Dima Sobolev 14 Dec 17
Replying to @sebmarkbage
Reply Retweet Like
Sebastian Markbåge 14 Dec 17
Replying to @hypercrabs
You’re catching on. :)
Reply Retweet Like
Steven Luscher 14 Dec 17
Replying to @sebmarkbage
areWeThereYet.js
Reply Retweet Like
Bogdan Chadkin 14 Dec 17
Replying to @sebmarkbage
That's awesome!
Reply Retweet Like
Richard Weekend 14 Dec 17
Replying to @sebmarkbage
If only we had native `maybe`
Reply Retweet Like
Richard Beddington 14 Dec 17
Replying to @sebmarkbage
Really cool, I’m guessing your ideal algebraic effects be able to run all the async stuff in parallel and handle them with something akin to Promise.all? And naturally be a bit more transparent than a throw!
Reply Retweet Like