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
Steven Luscher 14 Dec 17
Replying to @sebmarkbage
areWeThereYet.js
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
Jamie Dixon 14 Dec 17
Replying to @sebmarkbage
I see now. Yeah. Nice.
Reply Retweet Like
Alex Shtromberg ⚡️🌋 14 Dec 17
I haven't seen such use of throw :) its like cheating. But veeeery interesting!
Reply Retweet Like
Treeshaking is coming to town 14 Dec 17
Replying to @sebmarkbage
That's awesome!
Reply Retweet Like
Richard Torruellas 14 Dec 17
Replying to @sebmarkbage
If only we had native `maybe`
Reply Retweet Like
Dima Sobolev 14 Dec 17
Replying to @sebmarkbage
Reply Retweet Like
Sebastian Markbåge 14 Dec 17
Replying to @actualhypercrab
You’re catching on. :)
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
Brian Kejlberg 14 Dec 17
Replying to @sebmarkbage
This is SOOOOOOO wrong!
Reply Retweet Like
Ivan Babak 14 Dec 17
Replying to @sebmarkbage
Reply Retweet Like
Aaron Sikes 22 Dec 17
Replying to @sebmarkbage @machty
ember-sometimes-concurrency
Reply Retweet Like
Fredrik Höglund 30 Dec 17
Very interesting! While probably terrible in practice, I just realized doing runPureTask(() => ReactDOMServer.renderToString(...)).then(markup => ...); with the above actually works naively (but would have to hydrate cache to avoid server->client mismatch). :)
Reply Retweet Like
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
Daniel Hillerström 16 Jan 18
Replying to @sebmarkbage
That said, I'd be very interested in an encoding of handlers for algebraic effects via async/await. I have given it a few attempts myself, but so far they have all fallen short. The problem seems to be how to capture the continuation of an operation invocation.
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
Dima Sobolev 1 Mar 18
Replying to @sebmarkbage
import { Huh } from './future' 🙃
Reply Retweet Like
Brian Kejlberg 3 Mar 18
So close!
Reply Retweet Like