Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jul 12 12:05
    dependabot[bot] labeled #224
  • Jul 12 12:05
    dependabot[bot] opened #224
  • Jul 12 12:05

    dependabot[bot] on github_actions

    Bump coursier/cache-action from… (compare)

  • Jul 12 07:36
    scala-steward closed #221
  • Jul 12 07:36
    scala-steward commented #221
  • Jul 12 07:36
    scala-steward opened #223
  • Jul 03 04:06
    scala-steward opened #222
  • Jun 14 04:07
    scala-steward closed #219
  • Jun 14 04:07
    scala-steward commented #219
  • Jun 14 04:07
    scala-steward opened #221
  • Jun 08 16:07
    scala-steward opened #220
  • Jun 01 04:08
    scala-steward closed #215
  • Jun 01 04:08
    scala-steward commented #215
  • Jun 01 04:08
    scala-steward opened #219
  • May 28 07:52
    scala-steward opened #218
  • May 26 10:05
    scala-steward opened #217
  • May 23 16:20

    alexarchambault on master

    Update sbt-mima-plugin to 0.9.1… (compare)

  • May 23 16:20
    alexarchambault closed #216
  • May 23 16:06
    scala-steward opened #216
  • May 23 15:21
    alexarchambault closed #173
ykycxzsv
@ykycxzsv
it's been a while since i looked at scalacheck, but i think both Cogen and Arbitrary instances are needed for types to be generated? as noted in the issue, Arbitrary works with recursive types. possibly Cogen is more recent
Georgi Krastev
@joroKr21
Cogen is the dual of Gen (look at the signature of perturb - it combines the current seed with a value of some type to produce the next seed). This is useful for generating arbitrary functions in order perturb the seed for the result with the argument. So if you wanted Arbitrary[Tree => A] you would indeed need Cogen[Tree]. I don't see any theoretical limitation so it might just be a missing implementation.
Felipe Hummel
@felipehummel
Someone has any idea/pointers on how to solve this issue? alexarchambault/scalacheck-shapeless#55
It's a bit annoying to turn off the shrinking
wedens
@wedens
can I use scalacheck-shapeless to generate instance non-recursively? e.g. if I have case class X(y:Y, z: Z) I want it to generate Arbitrary[X] and use existing Arbitrary[Y] and Arbitrary[Z]
Daniela Sfregola
@DanielaSfregola
@wedens yes, you should be able to do that with no problem
make sure to have Arbitrary[Y] and Arbitrary[Z] implcitly in your scope....and it should just work
Addison Higham
@addisonj
looking for a bit of guidance, have some case classes that are tied together through some shared ids (they represent a data model), for example say I want to generate some data for case class Foo(accountId: Long, name: String) and case class Bar(accountId: Long, name: String) such that accountId is either equal or not for all instances of Foo or Bar. Is there a way to do that? Obviously I could just write a generator and choose accountId and create new instance manually, but some of these case classes have a lot parameters
Olli Helenius
@liff
is it possible/useful to explicitly materialize Arbitrary instances? this doesn't work for some reason
i'm hoping, by using explicit instances, it'd compile a bit faster maybe?
wedens
@wedens
org.scalacheck.derive.MkArbitrary[A].arbitrary
Olli Helenius
@liff
oh ok, thanks a lot
Cause Chung
@cuzfrog
@alexarchambault Is there any way to provide a non-empty arbString to substitute the string scalacheck-shapeless uses to gen class?
Simon Hafner
@reactormonk
@cuzfrog regular implicit replacement.
Cause Chung
@cuzfrog
@reactormonk thanks
Albert Serrallé Ríos
@aserrallerios
Hi all!
just a simple question
case class B(i:Int)
case class A(b:B)
implicit val _ = Arbitrary(implicitly[Arbitrary[B]].arbitrary.filter(_ == 0)))
val a = implicitly[Arbitrary[A]]
should a only generate B(0) instances?
Albert Serrallé Ríos
@aserrallerios
sorry guys, it's working
my problem was that I was not providing implicit instances of Arbitrary, but implicit instances of Gen :thumbsup:
Howy Perrin
@howyp
@alexarchambault Thanks for merging #77 , any idea when the next release might be?
Alexandre Archambault
@alexarchambault
@howyp I'll do a release after these few more updates: alexarchambault/scalacheck-shapeless#78.
Howy Perrin
@howyp
Great, thanks
Alexandre Archambault
@alexarchambault
Doing a release slipped my mind, will try to do it today if I can get my gpg keys from where I am right now…
Alexandre Archambault
@alexarchambault
@howyp 1.1.8 is out!
Howy Perrin
@howyp
🎉
Thanks!
Luciano
@lJoublanc
Morning. Does scalacheck-shapeless provide any sort of automatic coproduct generation? E.g. if I have a sealed trait, can I just do Arbitrary[MyTrait] and have it return it's subclasses?
Olli Helenius
@liff
@lJoublanc like this?
Luciano
@lJoublanc
exactly!
Would this work with Arbitrary[A :+: B :+: C] too, do you know?
I'll try it out.
Luciano
@lJoublanc
yeah that doesn't work :( trying to do Arbitrary[Int :+: Long]. On the other hand Arbitrary[AnyVal] does work, but I get lots of stuff I don't want (Unit) for example.
Georgi Krastev
@joroKr21
There is definitely an Arbitrary for Coproducts somewhere in there, maybe it's just not exposed. Look around the source code.
found it - MkCoproductArbitrary
Luciano
@lJoublanc
Thanks @joroKr21 will check it out today.
Marko Dimjašević
@mdimjasevic
Hi everyone!
I'd like to generate sequences of valid state machine transitions. Any idea how to do this with scalacheck-shapeless? I was thinking of using IndexedStateT from https://github.com/typelevel/cats/blob/master/core/src/main/scala/cats/data/IndexedStateT.scala to encode an input and output state of a transition.
Ihor Kaharlichenko
@kaharlichenko
Hi. Is there any way I could customize the generator for a case class? Suppose I have case class Person(name: String, age: Int) and I want age to be generated as Gen.posNum, while the rest of the field generators being derived?
Olli Helenius
@liff
@kaharlichenko well if you have arbPerson: Arbitrary[Person] you could do something like:
implicit val properArbPerson: Arbitrary[Person] = Arbitrary(arbPerson.arbitrary.flatMap(person => Gen.posInt.map(age => person.copy(age = age))))
alternatively you could create a distinct type for age, possibly with refined, newtype or otherwise. then you could just create an arbAge: Arbitrary[Age] and not worry about how a Person is generated
Ihor Kaharlichenko
@kaharlichenko
Well, changing the type of age is not an option, since that would involve changing the production code for the sake of testing. The second option is viable, though. Thank you.
Jason Pickens
@steinybot
Do the generated Arbitrarys ignore other implicits in scope? I haven’t been able to confirm or deny yet but it seems to be the case. For example:
case class Foo(bar: Bar)
implicit val arbBar: Arbitrary[Bar] = somePredefinedArbitraryForBar // This is not used
implicit val arbFoo: Arbitrary[Foo] = MkArbitrary[Foo].arbitrary
Jason Pickens
@steinybot
may have been a PBKAC error
Jason Pickens
@steinybot
Does the library work with recursive types?
I’m getting a StackOverflowError but it might just be me again
Paul Snively
@PaulAtFormation
Could someone please offer an example of generating a Shapeless Coproduct, presumably using the aforementioned MkCoproductArbitrary? I'm getting:
could not find implicit value for parameter mkArb: org.scalacheck.derive.MkCoproductArbitrary[takt.data.valkyrie.deployables.etl.VAL1081.ValkyrieType]
Alex
@unthingable
Hello. How does one confine generated String vals for a given case class to non-Unicode characters?
Daniel Sebban
@dsebban
Hi I am getting at runtime ava.lang.IllegalArgumentException: requirement failed: Duration is limited to +-(2^63-1)ns (ca. 292 years) [info] at scala.concurrent.duration.FiniteDuration.<init>(Duration.scala:583) [info] at scala.concurrent.duration.Duration$.apply(Duration.scala:31) [info] at scala.concurrent.duration.package$DurationLong$.durationIn$extension(package.scala:48) [info] at scala.concurrent.duration.package$DurationLong.durationIn(package.scala:48)