Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 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)

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

    alexarchambault on master

    Update sbt-scala-native-crosspr… (compare)

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[…]
Daniela Sfregola
@DanielaSfregola
ah! then it's my fault, not yours :) it's spec2 that wants an upsertion that makes sense :)
@liff thank you for looking into this!
Olli Helenius
@liff
also you could try using shapeless' cachedImplicit for caching the instance
Daniela Sfregola
@DanielaSfregola
thanks! I'll have a look
Daniela Sfregola
@DanielaSfregola
Hi @liff thank you again for looking into my issue this morning. Unfortunately, the problem is still there after fixing the test. You can see the sbt output at https://travis-ci.org/DanielaSfregola/random-data-generator/builds/160521352, the code at https://github.com/DanielaSfregola/random-data-generator/blob/scalacheck_shapeless_big_case_classes/src/test/scala/TestSpec.scala
Olli Helenius
@liff
@DanielaSfregola try with scalaVersion := "2.11.8" in your build.sbt
Daniela Sfregola
@DanielaSfregola
@liff amazing! changing the scala version fixed the issue :smile: thank you very much
Trupti
@truptitwt_twitter
Hi , I have a case class that takes an argument of type Option[javax.xml.datatype.XMLGregorianCalendar] . Does shapeless-scala library supports this type of parameter
Denis Mikhaylov
@notxcain
Hi! What could be the reason that my forAll does not terminate?
I found that if I remove a property with a type represented as sealed abstract class from a case class being generated it runs well.
Nicolas Rinaudo
@nrinaudo
I'm running in a weird problem using scalacheck-shapeless_1.13 (version 1.1.3). Here's the simplest code I could write to reproduce it:
import org.scalatest.FunSuite
import org.scalatest.prop.GeneratorDrivenPropertyChecks
import org.scalacheck.Shapeless._

class Testor extends FunSuite with GeneratorDrivenPropertyChecks {
  sealed trait Or[+A, +B] extends Product with Serializable
  case class Left[A](a: A) extends Or[A, Nothing]
  case class Right[B](b: B) extends Or[Nothing, B]

  test("reproduce") {
    forAll { (i: Int, f: IntFloat Or Boolean) ⇒
      f(i)
    }
  }
}
this almost always fails with the following error:
RetrievalError was thrown during property evaluation.
  Message: couldn't generate value
  Occurred when passed generated values (
    arg0 = 0, // 30 shrinks
    arg1 = <function1>
  )
as you might expect, the problem goes away as soon as you provide an explicit Arbitrary[Float Or Boolean], which I take as a pretty clear indication that the problem lies in the generic derivation of the Arbitrary instance
Nicolas Rinaudo
@nrinaudo
I'd be happy to provide more information or further tests if needed, and would appreciate any help I can get with this matter :)
Nicolas Rinaudo
@nrinaudo
alright, so this does not appear to be a scalacheck-shapeless problem explicitly. I've re-implemented a simple automatic derivation mechanim and run in exactly the same issues, and this didn't use to happen when using scalacheck 1.12.5. Possibly a scalacheck regression?
Nicolas Rinaudo
@nrinaudo
@alexarchambault in #50, when you talk about recursive types, does that include Or in the following example?
sealed trait Or[+A, +B] extends Product with Serializable
case class Left[A](a: A) extends Or[A, Nothing]
case class Right[B](b: B) extends Or[Nothing, B]
I would have thought not, but #51 does not seem to fix this use case as expected. Is it because the intermediate shapeless representation is recursive?
Alexandre Archambault
@alexarchambault
@nrinaudo alexarchambault/scalacheck-shapeless#51 should have fixed that... It even tests it.
Or shouldn't be considered recursive here, yeah. Recursive is meant for trees for example (where a constructor / case class references the base trait).
Nicolas Rinaudo
@nrinaudo
@alexarchambault probably my fault then, I thought I was on #51's latest commit but I might not be
I wanted to say I really appreciate how helpful you're being with this, by the way.
Zacharias J. Beckman
@zbeckman
I have a very general question (more oriented toward scalacheck than shapeless) – are there tools for generating complex properties that demonstrate a single negative trait? For instance, let's say you have a really, really large (deeply nested) data type. You want to generate a lot of positive properties but also negative ones -- but I don't want to have every attribute fail validation. I'd rather general hundreds of properties, each one with a single attribute 'wrong'.
So far I've been able to compose properties that have an essentially randomized number of 'wrong' attributes -- but there's always the chance that 1) there will be more than one attribute that's wrong, and 2) that eventually I'll generate a property that (randomly) happens to have zero negative attributes... so it won't fail.
ykycxzsv
@ykycxzsv
i have a recursive ADT, and when i implicitly derive a Cogen for it, i get a StackOverflowError at runtime. is there a trick to avoid that?
ykycxzsv
@ykycxzsv
is this project still active, or are there better alternatives for generating scalacheck types? no comment on the Cogen issue for months either here or in the issue tracker...
Georgi Krastev
@joroKr21
It works just fine for me and recently got my PR merged quite fast, so I would say it's active.
I commented on your issue, although I can't say whether the original intention was to support recursive types for Cogen or not.
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.