Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

massimosiani
Copy link

Addresses #4562.
I followed the steps outlined here #3910 (comment), there's no Currency in scala js/native tough.

build.sbt Outdated Show resolved Hide resolved
Comment on lines +33 to +36
implicit private val arbitraryCurrency: Arbitrary[Currency] = Arbitrary(
Gen.oneOf(Currency.getAvailableCurrencies().asScala)
)
implicit private val cogenCurrency: Cogen[Currency] = Cogen[String].contramap(_.getCurrencyCode())
Copy link
Contributor

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.

Copy link
Author

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)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@armanbilge any better idea?

@massimosiani
Copy link
Author

Is the FutureSuite kind of flaky? I don't think it fails due to my changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants