Fork me on GitHub

I’ve been thinking about how it would be cool to be able to navigate a promise chain


I often have semi-long promise chains that fail somewhere in the middle and I end up having to go and add a bunch of prn or tap> to each link in the chain


it would be cool to be able to datafy a promise chain and it would give you the current value of the first link and the then attached to it, which you could call nav on to resolve the next link in the chain, and so on


Seems like promises are often side effecting. Would you plan on firing the promise each time it's walked? Or have some data version of the chain that can be walked without executing?


they only fire once per instantiation, so you could resolve the next value and if it’s the first run, execute the effect maybe?


Seems like it'd be a non-standard use-case... I haven't delved much into datafy/nav yet, but my expectation is that the walking is a non-side-effecting process. So you might need some explanatory language around that.


yeah this is all a non-starter because JS can’t block


it would have to be built into a tool, rather than using datafy/nav directly


Also nav does side effects in JVM. E.g. opening files, slurping a URI, querying a db


I can’t see how this would be possible with native promises, but I’m thinking about how it might be possible (if really desired) as a library