Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 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
  • May 23 15:21
    alexarchambault commented #173
  • May 23 15:19

    alexarchambault on master

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

  • May 23 15:19
    alexarchambault closed #214
  • May 23 14:04
    scala-steward opened #215
  • May 23 14:04
    scala-steward opened #214
  • May 23 13:34

    alexarchambault on master

    Update README.md (compare)

  • May 23 12:21

    alexarchambault on v1.3.0

    (compare)

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 ...
Edmondo Porcu
@edmondo1984
Hello everyone, how can I get my arbitrary for "integers"
to override a default one only for a specific field of a case class?
Luciano
@lJoublanc
Don't think you can do that. You may be able to override the arbitrary for that specific case-class instead though.
Dario Abdulrehman
@dabd
I may be using it incorrectly but I attempted to use scalacheck-shapeless to automatically generate data for a sealed trait hierarchy. It turned out that the generators are very generic and not very useful for my purposes. For example a case class with a String field apparently uses Arbitrary.arbString and that is too generic for my application. Is there a way to customise the generators for a field using the library?
Dario Abdulrehman
@dabd
The only way around it I found is to use tagged types and write Arbitrary implicits.
Georgi Krastev
@joroKr21
I guess depending on your taste you could also just import your own implicit Arbitrary[String]
If you don't mind having orphan typeclass instances
Dario Abdulrehman
@dabd
I suppose @edmondo1984 was asking a similar question above
Dario Abdulrehman
@dabd
@joroKr21 and what if your case class has two different fields of type String which need different instances of Arbitrary. I think in this case you have to use tagged types.
Georgi Krastev
@joroKr21
I'm not sure I would have to check
Dario Abdulrehman
@dabd
The implicit mess + tagged types makes it easier to just hand-craft the case class generators.
Georgi Krastev
@joroKr21
yeah if you want customization might be easier to handroll it
with mapN
In theory it would be easy to make it work with LabelledGeneric