-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Currency instances #4564
base: main
Are you sure you want to change the base?
Currency instances #4564
Conversation
kernel/src/main/scala/cats/kernel/instances/CurrencyInstances.scala
Outdated
Show resolved
Hide resolved
implicit private val arbitraryCurrency: Arbitrary[Currency] = Arbitrary( | ||
Gen.oneOf(Currency.getAvailableCurrencies().asScala) | ||
) | ||
implicit private val cogenCurrency: Cogen[Currency] = Cogen[String].contramap(_.getCurrencyCode()) |
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.
Perhaps, it would not hurt if we put these instances into cats.laws.discipline.arbitrary
to make them available for everyone.
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.
I'm wrapping my head around the dependency graph here. Doesn't the laws
module depend on this one? If we want to add these instances to kernel-laws
, is there a way to add jvm-only code without moving too many files (kernel-laws
is defined as CrossType.Pure
)? Sorry not very used to cross compilation.
@@ -48,4 +49,8 @@ private[cats] object scalaVersionSpecific { | |||
that: T | |||
)(implicit w1: A => TraversableLike[El1, Repr1], w2: T => IterableLike[El2, Repr2]) = (a, that).zipped | |||
} | |||
|
|||
implicit class setExtension[A](private val a: A) extends AnyVal { | |||
def asScala(s: java.util.Set[A]): mutable.Set[A] = `set asScala`(s) |
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.
@armanbilge any better idea?
Is the |
Addresses #4562.
I followed the steps outlined here #3910 (comment), there's no
Currency
in scala js/native tough.