Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate succeedLazy #1377

Merged
merged 8 commits into from Aug 13, 2019
Merged

Deprecate succeedLazy #1377

merged 8 commits into from Aug 13, 2019

Conversation

ioleo
Copy link
Member

@ioleo ioleo commented Aug 10, 2019

Fixes #1346

  • Deprecated all succeedLazy methods.
  • Delegated all deprecated methods to succeed.
  • Added missing succeed to ZSink, Sink and ZStreamChunk.
  • Removed succeedLazy test from RTSSpec
  • Replaced succeedLazy with effect or effectTotal where laziness was essential and with succeed where lazyness was not required
  • Updated docs

@ioleo ioleo force-pushed the deprecate-succeed-lazy branch 2 times, most recently from 03f88bb to 96e92f8 Compare August 10, 2019 18:48
@ioleo ioleo force-pushed the deprecate-succeed-lazy branch 2 times, most recently from 849ffd9 to dd24d0d Compare August 10, 2019 20:09
@ioleo
Copy link
Member Author

ioleo commented Aug 10, 2019

@shankarshastri Fixed docs.

@neko-kai
Copy link
Member

Delegated all deprecated methods to succeed.

I think we should delegate to effectTotal to not break existing usages and since effectTotal is now the only blessed way to delay evaluation.

Copy link
Member

@neko-kai neko-kai left a comment

Choose a reason for hiding this comment

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

Thank you for the hard work! 🙏 Some comments, and I do think the deprecated methods should redirect to effectTotal (or possibly stay unmodified) to not break callers on upgrade.

benchmarks/src/main/scala/zio/IODeepFlatMapBenchmark.scala Outdated Show resolved Hide resolved
benchmarks/src/main/scala/zio/IOLeftBindBenchmark.scala Outdated Show resolved Hide resolved
benchmarks/src/main/scala/zio/IOMapBenchmark.scala Outdated Show resolved Hide resolved
core-tests/jvm/src/test/scala/zio/IOSpec.scala Outdated Show resolved Hide resolved
core-tests/jvm/src/test/scala/zio/IOSpec.scala Outdated Show resolved Hide resolved
core/shared/src/main/scala/zio/Fiber.scala Show resolved Hide resolved
@vasilmkd
Copy link
Contributor

What is the impact of this on ZStream, given that ZManaged.succeedLazy is used to implement effectful folding? /cc @iravid

@iravid
Copy link
Member

iravid commented Aug 11, 2019

ZManaged.succeedLazy(a) is just ZManaged.fromEffect(ZIO.effectTotal(a)) so we can name that ZManaged.effectTotal. Can be done in a separate PR as other data types have a succeedLazy too.

@ioleo ioleo force-pushed the deprecate-succeed-lazy branch 2 times, most recently from 4806bcf to 9836ca5 Compare August 11, 2019 20:32
@ioleo
Copy link
Member Author

ioleo commented Aug 11, 2019

@Kaishh
There is no effectTotal on Fiber, STM, Schedule, ZSchedule, Sink, ZSink, StreamPure, ZStream and ZStreamChunk. For all others I've switched to effectTotal as you sugested. For Managed / ZManaged I introduced effectTotal as @iravid suggested.

@jdegoes
Copy link
Member

jdegoes commented Aug 13, 2019

@ioleo Excellent work, thank you for this! 🙏

@jdegoes jdegoes merged commit 062024e into zio:master Aug 13, 2019
@ioleo ioleo deleted the deprecate-succeed-lazy branch August 13, 2019 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate all succeedLazy
6 participants