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

Cats instances for Scalacheck Gen? #589

Open
armanbilge opened this issue Oct 2, 2022 · 1 comment
Open

Cats instances for Scalacheck Gen? #589

armanbilge opened this issue Oct 2, 2022 · 1 comment

Comments

@armanbilge
Copy link

Specifically, to help with this:

// There is only one overload for the `forall` that takes an explicit `Gen` parameter
// To use multiple `Gen` instances, compose them monadically before passing to `forall`
test("Multiple Gen form") {
// Compose into a single `Gen[(Int, Int)]`
val gen = for {
a <- Gen.posNum[Int]
b <- Gen.posNum[Int]
} yield (a, b)

Which is a reasonable setup IMO. Personally I'm just missing some of the handy combinators for composition. E.g. it would be nice to express that example using .product or .tupled instead of needing the multi-line for ... yield.

There's options like cats-scalacheck but it would be very convenient to be able to do this out-of-the-box.

@Baccata
Copy link
Contributor

Baccata commented Oct 2, 2022

So you're suggesting inlining the instances in weaver ? I'm not fundamentally opposed to it

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

No branches or pull requests

2 participants