-
Notifications
You must be signed in to change notification settings - Fork 515
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
Accept Duration
for all time-based combinators
#3098
Accept Duration
for all time-based combinators
#3098
Conversation
… topic/more-duration
private[effect] def handleDuration[A](duration: Duration, ifInf: => A)( | ||
ifFinite: FiniteDuration => A): A = | ||
duration match { | ||
case _: Duration.Infinite => fa | ||
case finite: FiniteDuration => f(finite) | ||
case fd: FiniteDuration => ifFinite(fd) | ||
case Duration.Inf => ifInf | ||
case d => | ||
throw new IllegalArgumentException( | ||
s"Duration must be either a `FiniteDuration` or `Duration.Inf`, but got: $d") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we're here, should we also do something about negative FiniteDuration
s?
Something I'm leery about is that these changes introduce a lot of branches that aren't currently tested by our laws which I think work in terms of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems good if we can get it to build. :-)
Heh, I was waiting for a positive sign before continuing :) I'm on it! |
Follow-up to #2954.