Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 24 05:03
    scala-steward opened #245
  • Jan 23 21:54

    alexarchambault on master

    Update sbt-scalajs, scalajs-com… (compare)

  • Jan 23 21:54
    alexarchambault closed #244
  • Jan 23 19:05
    scala-steward opened #244
  • Jan 23 18:27

    alexarchambault on master

    Update auxlib, javalib, nativel… (compare)

  • Jan 23 18:27
    alexarchambault closed #243
  • Jan 23 18:27

    alexarchambault on master

    Update sbt-ci-release to 1.5.10… (compare)

  • Jan 23 18:27
    alexarchambault closed #232
  • Jan 23 18:26

    alexarchambault on master

    Update sbt-scalajs, scalajs-com… (compare)

  • Jan 23 18:26
    alexarchambault closed #231
  • Jan 22 15:04
    scala-steward opened #243
  • Jan 20 17:19
    scala-steward synchronize #231
  • Jan 20 17:19
    scala-steward synchronize #232
  • Jan 20 13:51

    alexarchambault on master

    Update auxlib, javalib, nativel… (compare)

  • Jan 20 13:51
    alexarchambault closed #235
  • Jan 20 13:49

    alexarchambault on master

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

  • Jan 20 13:49
    alexarchambault closed #230
  • Jan 13 05:10
    scala-steward closed #234
  • Jan 13 05:10
    scala-steward commented #234
  • Jan 13 05:10
    scala-steward opened #242
Dario Abdulrehman
@dabd

Looking at the source there is a

implicit def derivedShrink[T]
   (implicit
     ev: LowPriority.Ignoring[Witness.`"shrinkAny"`.T],
     underlying: Strict[MkShrink[T]]
   ): Shrink[T] =
    underlying.value.shrink

But I don't understand what it does.

Jack Low
@wjlow
Is it possible to generate an Arbitrary instance using scalacheck-shapeless for my ADT that has a generic type in one of its cases?
sealed trait A
case class Foo[T](value: T) extends A
case class Bar(value: String) extends A
4 replies
Adrian
@adrian-salajan

Hello, can scalacheck-shapeless work with case classes with in turn have fields like Instant / Date / Curency / scala enumeratum, if there are "manual" arbitraries provided for these ?
I can't seem to make it work
the closest i get is to a

 scala.UninitializedFieldError: Uninitialized field

edit: it works just have to have all the implicit imports near
import org.scalacheck.ScalacheckShapeless._

Howy Perrin
@howyp
Hey @alexarchambault - is there a plan to release scalacheck-shapeless for Scalacheck 1.15 ?
Buk Lau
@mk9023_gitlab
Hi :wave:
I am experiencing an issue with the library that is described in this ticket: alexarchambault/scalacheck-shapeless#46
Will this be fixed in 1.15 or is not going to be fixed?
I have a case class and one of the fields is an Option of a type which is an ADT (a sealed trait with sum types) but when I get runtime exceptions when it tries to generate instances for it
If I take out the Option with that sealed trait all is fine
Buk Lau
@mk9023_gitlab
Is this version: "com.github.alexarchambault" %% "scalacheck-shapeless_1.14" % "1.2.5" compatible with
"org.scalatest"              %% "scalatest"                      % "3.2.3"          % Test,
"org.scalatestplus"          %% "scalacheck-1-15"                % "3.2.3.0"        % Test,
?
Buk Lau
@mk9023_gitlab
I fixed the issue - it only works with "org.scalatestplus" %% "scalacheck-1-14"
Artem Nikiforov
@nikiforo

Hi all,
I'm using "com.github.alexarchambault" %% "scalacheck-shapeless_1.14" % "1.2.5", scala 2.13.5.
I expect implicitly[Arbitrary[IntWr]] to use arb in the code below, but it doesn't.

  case class IntWr(int: Int)

  val intGen = Gen.choose(5, 9)

  def shapelessCustom = {
    import org.scalacheck.ScalacheckShapeless._
    implicit val arb: Arbitrary[Int] = Arbitrary(intGen)
    mkList(implicitly[Arbitrary[IntWr]])
  }

  private def mkList[T](gen: Arbitrary[T]): List[T] =
    List.fill(10)(gen.arbitrary.sample.get)

For instance, here the correct Arbitrary[Int] is used:

def custom: List[Int] = {
    implicit val arb: Arbitrary[Int] = Arbitrary(intGen)
    mkList(implicitly[Arbitrary[Int]])
  }

Is this behavior expected?
How can I use custom arbitrary for a case class attribute?

Georgi Krastev
@joroKr21
How do can you tell that it's not used?
Artem Nikiforov
@nikiforo

How do can you tell that it's not used?

two evidences:

  1. Warning that isn't used
  2. Println on both lists gives:
    // List(7, 5, 5, 8, 6, 8, 7, 5, 7, 6)
    // List(IntWr(-2147483648), IntWr(1263246479), IntWr(1791721042), IntWr(0), IntWr(-90407902))
Georgi Krastev
@joroKr21
Hmm ok 1. btw it could also warn even when it's used depending on your configuration. Because an implicit which is used only after a macro has expanded might be detected too late. But the println is a good indicator :thumbsup:
❯ scala -Wmacros:help
Usage: -Wmacros:<mode> where <mode> choices are none, before, after, both (default: before).
  none    Do not inspect expansions or their original trees when generating unused symbol warnings.
  before  Only inspect unexpanded user-written code for unused symbols.
  after   Only inspect expanded trees when generating unused symbol warnings.
  both    Inspect both user-written code and expanded trees when generating unused symbol warnings.
Georgi Krastev
@joroKr21
Well ... it works on my machine :smile: https://scastie.scala-lang.org/7Ji2AhrCT5GK2FGyJ3yG8A
Artem Nikiforov
@nikiforo
❯ scala -Wmacros:help
Usage: -Wmacros:<mode> where <mode> choices are none, before, after, both (default: before).
Wow, I didn't know that compiler flags show some help this way. Neither I knew about flag -Wmacros :)).
Your message is about the first "evidence"? That without the second one my argument would be week?

Well ... it works on my machine :smile: https://scastie.scala-lang.org/7Ji2AhrCT5GK2FGyJ3yG8A

hmmmmm

Thanks!
Interesting... I'll look closer and try to narrow it somehow
Georgi Krastev
@joroKr21
:thumbsup:
Paul Snively
@paul-snively
Hi everyone! Does anyone know when we can look forward to a Scalacheck 1.15.x release? :-)
skestle
@skestle
If I provide an implicit arbitrary for a deep field in a nested type, should scalacheck-shapeless use it? (Mine isn't, wondering if that's expected behaviour)
skestle
@skestle
Yes, yes it does; My specific arbitrary implementation to produce valid data did not, in-fact, produce valid data. Now that it's fixed, everything works as hoped.
dantb
@dantb
Hey, are there any plans to move this library to Scala 3 (using shapeless 3 or otherwise)?
dantb
@dantb
paging @alexarchambault . We have started looking at doing it, don't want to duplicate any work though