Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 15 12:30

    dependabot[bot] on github_actions

    (compare)

  • Aug 15 12:30

    alexarchambault on master

    Bump coursier/setup-action from… (compare)

  • Aug 15 12:30
    alexarchambault closed #268
  • Aug 15 12:07
    dependabot[bot] labeled #268
  • Aug 15 12:07
    dependabot[bot] opened #268
  • Aug 15 12:07

    dependabot[bot] on github_actions

    Bump coursier/setup-action from… (compare)

  • Aug 11 12:35

    alexarchambault on master

    Bump version in README (compare)

  • Aug 11 10:11

    alexarchambault on v1.3.1

    (compare)

  • Aug 11 10:08

    alexarchambault on update-readme

    (compare)

  • Aug 11 10:08

    alexarchambault on master

    Update module name suffix (#267) (compare)

  • Aug 11 10:08
    alexarchambault closed #267
  • Aug 11 09:57
    alexarchambault opened #267
  • Aug 11 09:57

    alexarchambault on update-readme

    Update module name suffix (compare)

  • Aug 11 09:55
    alexarchambault closed #256
  • Aug 11 09:55

    alexarchambault on master

    Update scalacheck to 1.16.0 (#2… (compare)

  • Aug 11 09:50
    alexarchambault synchronize #256
  • Aug 11 09:49

    alexarchambault on sbt-main-line

    (compare)

  • Aug 11 09:49

    dependabot[bot] on github_actions

    (compare)

  • Aug 11 09:49

    alexarchambault on master

    Bump coursier/setup-action from… (compare)

  • Aug 11 09:49
    alexarchambault closed #260
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)
is there a way to override the Duration generator implicit with a correct one
?
Gabriel Assis Bezerra
@gabriel-bezerra
as far as I know, the Arbitrary[T]s in scope are preferred instead of the derived ones
import /*the automatic derivation from the library*/

implicit val arbitraryDuration: Arbitrary[Duration] = ...

implicitly[Arbitrary[SomethingThatNeedsDuration]] // this should use arbitraryDuration
Luciano
@lJoublanc

Was just about to post practically the same question as above ... I have:

case class Dense[K: Field](layout: Layout, stride: Int)

but if I put an implicit val stride: Arbitrary[Int] = ... before forAll, in order to limit the values of stride, it's not being picked up. It sounds like the same problem as above?

Luciano
@lJoublanc
@dsebban how did you finally resolve your issue?
Luciano
@lJoublanc
Ah figured it out - it's the old 'shrink' problem ...