Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@regiskuckaertz
Copy link
Member

Closes #1532

cc @iravid

Stream("A", "B", "C")
.scheduleWith(Schedule.recurs(3) *> Schedule.fromFunction((_) => "!"))(_.toLowerCase, identity)
Stream("A", "B", "C", "A", "B", "C")
.scheduleWith(Schedule.recurs(2) *> Schedule.fromFunction((_) => "Done"))(_.toLowerCase, identity)
Copy link
Member

Choose a reason for hiding this comment

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

Hmm why did it change to 2?

Copy link
Member Author

Choose a reason for hiding this comment

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

Schedule.recurs(2) will consume three elements, as in the test for scheduleWith

Copy link
Member

Choose a reason for hiding this comment

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

Ok let me wrap my head around this for a sec..running your state machine manually ;)


// The stream ends when both the underlying stream ends and the final
// schedule value has been emitted
case None => Pull.end
Copy link
Member

Choose a reason for hiding this comment

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

This means that we don't emit the schedule's final value if the stream ended before the schedule ended. Is that intentional?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. If for instance the stream is completely empty, there never was a value of type a to update the schedule.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, I'm good with that 👍🏻

@iravid iravid merged commit 96a598e into zio:master Sep 22, 2019
@regiskuckaertz regiskuckaertz deleted the rk-stream-schedule branch September 22, 2019 09:16
ghostdogpr pushed a commit that referenced this pull request Sep 22, 2019
* Migrate StackBoolSpec to ZIO Tests (#1647)

* Fix build issues introduced by bundling (#1754)

* #1647 - converted SerializableSpec to ZTest (#1769)

* Move PlatformLive.ExecutorUtil to Executor companion object. private zio.internal.Sync (#1770)

* Modified dies signature (#1768)

* Modified dies signature

* Added type parameter

* Removed type parameter

* Restart schedule on end in ZStream#scheduleWith (#1767)

* Restart schedule on end

* Remove unused state, add docs

* Port ZStream.fromInputStream to StreamEffect #1460 (#1772)

* Port ZStream.fromInputStream (the one in platform.scala) to StreamEffect #1460

* Port ZStream.fromInputStream (the one in platform.scala) to StreamEffect #1460

* code review updates

* code review updates

* moved buffer to pull call, to avoid mutation

* catch exception and use StreamEffectChunk

* Specify that this fiber will be "inner interrupted" on joining an interrupted Fiber (#1774)

* #1647: Migrate all tests to ZIO Test: Platform spec (#1775)

* Migrate Fiber tests to ZIO Tests (#1647) (#1777)

* Update zio-interop-java to 1.1.0.0-RC5 (#1781)

* Update fs2-core to 2.0.1 (#1779)

* Update sbt-pgp to 1.1.2 (#1780)

* Update zio-interop-monix to 3.0.0.0-RC6 (#1782)

* updated resources page to add my examples (#1783)

* Migrate ZScheduleSpec to ZIO Tests (#1647)
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.

Enhance ZStream#scheduleWith to not short-circuit the stream

2 participants