typelevel / cats-time Goto Github PK
View Code? Open in Web Editor NEWCats Instances for Java Time
Home Page: https://typelevel.org/cats-time/
License: MIT License
Cats Instances for Java Time
Home Page: https://typelevel.org/cats-time/
License: MIT License
it would be nice to have Timestamp and Date instances. I tentatively implemented in my hobby project: https://github.com/chenharryhua/nanjin/blob/master/datetime/src/main/scala/com/github/chenharryhua/nanjin/datetime/DateTimeInstances.scala#L12
happy to raise a pull request if you're OK with that.
Is there a reason that there's no Year instances or just oversight? I could create a quick PR if that's wanted :)
It would be nice to use TimeArbitraries
outside cats-time
. Perhaps it could use the testkit
style to make it importable
Thanks
It seems my instances for ZoneId
and ZoneOffset
are slightly broken. When importing io.chrisdavenport.cats.time.instances.all._
, I get a conflict when trying to show
a ZoneOffset
:
scala> show"${ZoneOffset.UTC}"
<console>:22: error: type mismatch;
found : java.time.ZoneOffset
required: cats.Show.Shown
show"${ZoneOffset.UTC}"
^
This arises because there are two overlapping instances for ContravariantShow[-T]
:
scala> Show.Shown.mat(ZoneOffset.UTC)
<console>:22: error: ambiguous implicit values:
both value zoneidInstances in trait zoneid of type => cats.Show[java.time.ZoneId] with cats.Eq[java.time.ZoneId] with cats.Hash[java.time.ZoneId]
and value zoneoffsetInstances in trait zoneoffset of type => cats.Show[java.time.ZoneOffset] with cats.Order[java.time.ZoneOffset] with cats.Hash[java.time.ZoneOffset]
match expected type cats.Show.ContravariantShow[java.time.ZoneOffset]
Show.Shown.mat(ZoneOffset.UTC)
^
, and the compiler can't choose a better one.
I'm not sure what would be the best course of action here. Removing Show[ZoneOffset]
would fix interpolation, however most of generic code I've seen relies directly on Show
!
According to the request from @armanbilge we need to migrate to sbt-typelevel.
Documentation is available here:
https://github.com/typelevel/sbt-typelevel/#readme
Christopher, Thanks so much for creating this and several other pure FP libraries. Would you be open to listing them on cats homepage for easier discovery?
I believe that these projects should offer a friendly and safe space for working together. I am in the process of adding this to most of my libraries.
If you have comments to this regard, I would like to hear them and this issue will be a good place to field such discussions.
As far as I've understood scala-native was introduced in 0.5.1, according to the version mapping
lazy val commonNativeSettings = Seq(
tlVersionIntroduced := List("2.12", "2.13", "3").map(_ -> "0.5.1").toMap
)
It would be great to make a fresh release of this lib, with the respective scala-native support.
sbt-scala-native
plugin, maybe worth downgrading to 0.4.5I get this when trying to access the microsite https://christopherdavenport.github.io/cats-time/
We should make a release with the changes in particular Scala 3 supooet and the change of the modules
I'll try to produce a RC to test the waters
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.