Cats: Add FiniteDuration instances

Created on 19 Sep 2018  路  8Comments  路  Source: typelevel/cats

We currently have instances for Duration only, which means that you can use FiniteDuration with it, but must upcast it, which can be annoying:

3.minutes |+|聽3.minutes // Fails to compile because `|+|` is not a member of `FiniteDuration`.
help wanted low-hanging fruit

Most helpful comment

I will do it :)

All 8 comments

I will do it :)

Awesome, thank you @satansk.
You can basically reuse the Duration implementations already present in cats-kernel :)

I use FiniteDurations all the time, Durations not so much 馃挴

@satansk If you're still working on this feel free to keep going :) Can we just reuse https://github.com/typelevel/cats/blob/master/kernel/src/main/scala/cats/kernel/instances/duration.scala

With FiniteDuration instead of `Duration?

Where do these instances go? @codecentric

Thanks!

Yes the instances should be exactly the same :) and you should be able to place them analogously to where the duration instances are placed

I opened a PR here, @satansk if you wanted to work on this i'm more than happy to close it!

@calvinbrown085 go ahead :)

I'm busy for a release in company, and I was planning to work on this on my 7 days vocation one day later. Since you already have made a PR, just keep on working on it.

@satansk Sounds good! Just making sure I don't trample on anyone :)

Was this page helpful?
0 / 5 - 0 ratings