Generation of arbitrary case classes / ADTs with scalacheck and shapeless
dependabot[bot] on github_actions
alexarchambault on master
Bump coursier/setup-action from… (compare)
dependabot[bot] on github_actions
Bump coursier/setup-action from… (compare)
alexarchambault on master
Bump version in README (compare)
alexarchambault on v1.3.1
alexarchambault on update-readme
alexarchambault on master
Update module name suffix (#267) (compare)
alexarchambault on update-readme
Update module name suffix (compare)
alexarchambault on master
Update scalacheck to 1.16.0 (#2… (compare)
alexarchambault on sbt-main-line
dependabot[bot] on github_actions
alexarchambault on master
Bump coursier/setup-action from… (compare)
Arbitrary
instances? this doesn't work for some reason
case class B(i:Int)
case class A(b:B)
implicit val _ = Arbitrary(implicitly[Arbitrary[B]].arbitrary.filter(_ == 0)))
val a = implicitly[Arbitrary[A]]
a
only generate B(0) instances?
Arbitrary
, but implicit instances of Gen
:thumbsup:
Arbitrary[A :+: B :+: C]
too, do you know?
MkCoproductArbitrary
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.
Arbitrary
s 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
could not find implicit value for parameter mkArb: org.scalacheck.derive.MkCoproductArbitrary[takt.data.valkyrie.deployables.etl.VAL1081.ValkyrieType]
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)
import /*the automatic derivation from the library*/
implicit val arbitraryDuration: Arbitrary[Duration] = ...
implicitly[Arbitrary[SomethingThatNeedsDuration]] // this should use arbitraryDuration
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?