Skip to content

Sync run convenience function - #2613

Merged
djspiewak merged 4 commits into
typelevel:series/3.xfrom
djspiewak:feature/sync-convenience-js
Dec 20, 2021
Merged

Sync run convenience function#2613
djspiewak merged 4 commits into
typelevel:series/3.xfrom
djspiewak:feature/sync-convenience-js

Conversation

@djspiewak

Copy link
Copy Markdown
Member

Fixes #2530
Supersedes #2478

Adds unsafeRunSyncToFuture to IO on Scala.js only. This uses a new overload of syncStep which takes an integer number of steps to allow prior to forcing a yield, defaulting that value to the autoYieldThreshold from the runtime itself. We could also mark the old syncStep as private[effect] if we want to clean things up a bit.

This is a good example of a change which is not source-breaking but which is forward-incompatible. I bumped the version to 3.4 to account for this. Please discuss and bikeshed.

armanbilge
armanbilge previously approved these changes Nov 30, 2021

@armanbilge armanbilge left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, this looks really great to me! 😁

I think it's worth deprecating the old syncStep, totally removing it without a deprecation phase is a bit rough :P but it would be good to force users to reckon with the ceding/limit issue.

@armanbilge

Copy link
Copy Markdown
Member

It occurred to me, we should also have unsafeRunSyncToPromise since this is for JS anyway :)

@djspiewak
djspiewak requested a review from armanbilge December 19, 2021 07:25

@armanbilge armanbilge left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@djspiewak I added an unsafeRunSyncToPromise method as well, since this is JS land.

@djspiewak
djspiewak merged commit 6949491 into typelevel:series/3.x Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bring back IO#runAsync and friends?

2 participants