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

Skip to content

Conversation

@adamgfraser
Copy link
Contributor

Resolves #4218.

The main problem with this is that since we have to run the schedule before the effect we don't have an A value to provide to the Schedule initially so we need a Schedule with an input type of Any, which works for time based recurrence but doesn't allow the schedule to continue to depend on the prior result of running the effect. Potentially we could have a variant that accepts an initial A value to kick off the schedule though that is not ideal because we would like the schedule to completely describe the pattern of recurrence.

@adamgfraser adamgfraser requested a review from jdegoes October 8, 2020 01:22
/**
* Runs this effect according to the specified schedule.
*/
final def schedule[R1 <: R, B](schedule: Schedule[R1, Any, B]): ZIO[R1 with Clock, E, B] =
Copy link
Member

Choose a reason for hiding this comment

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

How about this:

scheduleWith(a)(schedule)

Then:

def schedule(s) = scheduleWith(())(s)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly.

jdegoes
jdegoes previously approved these changes Oct 8, 2020
Copy link
Member

@jdegoes jdegoes left a comment

Choose a reason for hiding this comment

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

Looks great!

I might consider the names scheduleFrom, i.e. schedule starting from this value.

But the signatures look correct. Feel free to merge when ready!

@adamgfraser
Copy link
Contributor Author

Sounds good to me!

@jdegoes jdegoes merged commit 0797371 into zio:master Oct 8, 2020
@adamgfraser adamgfraser deleted the 4218 branch October 13, 2020 23:33
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.

Replace ZIO#repeat(Schedule) with ZIO#schedule(Schedule)

2 participants