cats icon indicating copy to clipboard operation
cats copied to clipboard

Proposal: merge `cats-time` into `cats`

Open diesalbla opened this issue 4 years ago • 5 comments

cats-time is a microlibrary that implements instances of kernel typeclasses, such as Show, Ord, Eq, or Hash, for the classes of the java.time package. This package was introduced in version 8.0 of the JDK, in order to replace previous unsatisfactory classes (such as java.Date), and was derived from joda-time.

The proposal is that these files be merged into the kernel package, and the cats-time library archived.

Some considerations on this matter are as follows:

  • Precedent: there is a trait of instances for java.util.UUID already in kernel.
  • java.time is just as standard a library as Option, Either, so it is reasonable to also include its instances in the package.
  • Adding instances for a JDK-specific class would add a coupling between cats and the JVM platform specifically, but as mentioned that already happens with java.util.UUID.
  • This would make the cats kernel incompatible with JDK pre-8 versions. The existing instance for UUID only adds incompatibility with pre-1.5 JDKs. Note that JDK 8 was released in March 2014, almost seven years ago, so I am not sure how far cats retrocompatibility should go.

diesalbla avatar Feb 03 '21 11:02 diesalbla

Since cats already requires Java 8+ as of version 2.1.0 because it's only published for Scala 2.12+, I think this proposal is very sensible

DavidGregory084 avatar Feb 03 '21 11:02 DavidGregory084

The only major concern here would be around ScalaJS support.

djspiewak avatar Feb 03 '21 20:02 djspiewak

The only major concern here would be around ScalaJS support.

In other projects there is a separation of sources that are JS-specific or JVM-specific. Perhaps we can do the same here? As noted, this already happens with UUID.

diesalbla avatar Feb 03 '21 21:02 diesalbla

Strong :+1:. We shouldn't accept a lesser experience on our flagship platform when a feature is not supported by a secondary platform. And for the Java 8 requirement, public support for Java 7 ended in 2015.

rossabaker avatar Feb 03 '21 21:02 rossabaker

Taking existing support into account, I have opened PR to integrate this into the cats.kernel...

diesalbla avatar Feb 03 '21 23:02 diesalbla