Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 01 21:15
    scala-steward opened #234
  • Oct 21 16:04
    scala-steward opened #233
  • Oct 14 14:04
    scala-steward opened #232
  • Oct 06 22:09
    scala-steward opened #231
  • Oct 06 14:04
    scala-steward opened #230
  • Oct 05 14:12

    alexarchambault on scala-cli

    Update sbt-mima-plugin to 1.0.0… Switch build to Scala CLI (compare)

  • Oct 05 14:11

    alexarchambault on scala-cli

    (compare)

  • Oct 05 11:05

    alexarchambault on master

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

  • Oct 05 11:05
    alexarchambault closed #229
  • Oct 05 10:08
    scala-steward opened #229
  • Oct 05 09:22

    alexarchambault on issue7

    (compare)

  • Oct 05 09:22

    alexarchambault on orphans

    (compare)

  • Oct 05 09:22

    alexarchambault on scalacheck-shapeless-1.0

    (compare)

  • Oct 05 09:22

    alexarchambault on scalacheck-shapeless-0.1

    (compare)

  • Oct 05 09:22

    alexarchambault on scalacheck-1.12

    (compare)

  • Oct 05 09:22

    alexarchambault on scalacheck-shapeless-1.1

    (compare)

  • Oct 05 09:22

    alexarchambault on scalacheck-shapeless-0.3

    (compare)

  • Oct 05 09:21

    alexarchambault on master

    Update scala-library to 2.12.15… (compare)

  • Oct 05 09:21
    alexarchambault closed #227
  • Oct 05 09:21

    alexarchambault on master

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

Greg Pfeil
@sellout
So, I added scalacheck-shapeless, tried removing some Arbitrary instances, but now compilation is at least an order-of-magnitude slower. (Well, it’s actually still going, so we’ll see how that ends up.)
Greg Pfeil
@sellout
Ok, I think we can go with “nonterminating”.
Miles Sabin
@milessabin
shapeless's Lazy effectively turns off scalac's checks for implicit divergence. On the plus side that means we can build recursive instances (for recursive data types). On the minus side, that means that it is possible to make the typechecker loop if resolution doesn't actually converge.
If you can post an example (preferably reduced) of what you're trying to do we should be able to help you out.
Alexandre Archambault
@alexarchambault
@sellout The trick described here sometimes speeds up things a bit (along with allowing slow-to-compile parts of code not to be recompiled too often).
More generally, things can get quite slow with large code bases (having one at work, I didn't switch all derivations to the "canonical" way of doing of scalacheck-shapeless, that is Lazy-based)
@milessabin I ran into non terminating compilations too, only recently, when trying to replace upickle macros with shapeless. It only happened with orphan derivation on.
Alexandre Archambault
@alexarchambault
That's what made want to replace it, milessabin/shapeless#427
Noel Markham
@noelmarkham
Hi - is there a maven artifact for scalacheck-shapeless with scalacheck 1.13? I can see the commits but can't work out if there's a jar out there
Alexandre Archambault
@alexarchambault
@noelmarkham Yep, the current snapshot (1.0.0-SNAPSHOT) is built against scalacheck 1.13 and pushed to Sonatype Snapshots.
I just updated the README to reflect that.
See the end of it.
Noel Markham
@noelmarkham
brilliant, thanks for the update
Dario Abdulrehman
@dabd
Hi, I am trying to use scalacheck-shapeless to generate arbitrary case classes that are using tagged types. However scalacheck does not seem to be able to generate Arbitrary instances in this case: https://gist.github.com/dabd/fbf5336b51f4c5d3bcd1404a76498a88
Olli Helenius
@liff
might it be the same issue as travisbrown/circe#220 ?
does it work if you define an Arbitrary for String @@ Baz
Dario Abdulrehman
@dabd
@liff that is what the implicit conversion arbTagged should be doing isn't it?
Olli Helenius
@liff
yes, but it might be a bit too generic
Dario Abdulrehman
@dabd
I gave it a go with implicit val arbTaggedString: Arbitrary[String @@ Baz] = Arbitrary(tag[Baz](Arbitrary.arbString)) but it doesn't compile. Is this how you define an Arbitrary[String @@ Baz]?
Olli Helenius
@liff
just replace the type parameters with concrete types in your original:
implicit val arbTaggedString: Arbitrary[String @@ Baz] = Arbitrary(arbitrary[String].map(a => tag[Baz](a)))
Dario Abdulrehman
@dabd
yeah it works, thanks. It seems like I need to define these explicitly then. I wonder why the implicit def is not working then
Olli Helenius
@liff
indeed
wonder if it's some compiler bug related to type aliases or something
seems to work with a generic tag:
implicit def arbTaggedString[T]: Arbitrary[String @@ T] = Arbitrary(arbitrary[String].map(a => tag[T](a)))
but not for generic on the left (i.e. T @@ Baz)
Dario Abdulrehman
@dabd
yes it works. I'd like to understand why
Simon Hafner
@reactormonk
How do I pass in Arbitrary instances for .e.g. String? implicit val stringArb: Arbitrary[String] = Arbitrary.arbitrary[String] suchThat (_ != "") gives me a Gen[String].
implicit val stringArb: Arbitrary[String] = Arbitrary(Arbitrary.arbitrary[String] suchThat (_ != "")) looks like it works
Miguel Iglesias
@caente

I’m “generating” Arbitrarys instances for several data structures that are basically sealed traits hierarchies that include cases classes, which have parameters that are sealed traits hierarchies as well — different ones

The compile times are horrendous. The PoC was with all the Arbitrary instances declared in the same file, and the dependencies among them were handled “globally”… until that stopped working, i.e. it never finishes compiling.

I’m trying to make it the most modular as possible, any recomendation? (I’m hopping for hidden tricks and caveats)

Miguel Iglesias
@caente

I’d like to be only able to create an instance of Arbitrary of a sealed trait hierarchy, if all the parameters if the children have explicit-implicit Arbitrarys, e.g.

case class TimeConstraint( t:LocalTime, m:Modifier, a:Activity )

implicit def timeConstraintArb(
    implicit
    lt: Arbitrary[LocalTime],
    m:  Arbitrary[Modifier],
    a:  Arbitrary[Activity]
  ):Arbitrary[TimeConstraint]

where Modifer and Activity are also sealed traits
the goal is that this method does not compile if the instances are not present…
for example, this version with out Arbitrary[Activity]

implicit def timeConstraintArb(
    implicit
    lt: Arbitrary[LocalTime],
    m:  Arbitrary[Modifier]
  ):Arbitrary[TimeConstraint]

should not compile.

But if I just add import org.scalacheck.Shapeless._in the method body, then it will “just work”, which is undesirable here...

id there a way to achieve this?
I’ve been looking at the source, but it hasn’t being obvious...
Miguel Iglesias
@caente
the main goal of all this is still to find out why the compiler hangs forever
Miguel Iglesias
@caente
and to have more control over what Arbitrarys are being used
Gabriel Assis Bezerra
@gabriel-bezerra
Hi. After I have imported org.scalacheck.Shapeless._, my v match { case O1 => f(O1) } are failing with "possible missing interpolator: detected an interpolated expression"
I have no $ over there
have you ever seen such thing
btw, def f[A](v: V[_, A])(implicit a: Arbitrary[A]): Arbitrary[A] = a
I'm not using strings or any "s around
Gabriel Assis Bezerra
@gabriel-bezerra
updating from 1.1.0-RC1 to 1.1.0-RC3 fixed it
Daniela Sfregola
@DanielaSfregola
Hi guys, I am experiencing some funny behaviours when asking scalacheck-shapeless to generate an arbitrary of a big case class (22+ fields). In particular my class has 30 fields. You can have a look at the code here: https://github.com/DanielaSfregola/random-data-generator/blob/scalacheck_shapeless_big_case_classes/src/test/scala/TestSpec.scala
the code works in the REPL -- although the arbitrary generation take a few seconds
but when I compile the code with sbt, the compiler complains that the arbitrary cannot be found.
Do you guys think it's possible that, because there are a lot of fields, the compiler gives up after a while?
also, I have noticed that the generated arbitrary are not cached (so in my case, the same arbitrary is generated over and over again)
Do you think this could be fixed? I think it will improve the compilation time significantly. Let me know what you guys think, happy to give it a try and open a PR on it!
Cheers
Olli Helenius
@liff
@DanielaSfregola that code gives me:
could not find implicit value for evidence parameter of type org.specs2.main.CommandLineAsResult[org.scalacheck.Arbitrary[BigExample]]
but works fine if i add 1 must_== 1 after implicitly[…]