Generation of arbitrary case classes / ADTs with scalacheck and shapeless
alexarchambault on scala-cli
Switch build to Scala CLI Use Scala CLI nightly (compare)
alexarchambault on master
Update sbt to 1.6.2 (#246) * A… (compare)
alexarchambault on scala-cli
Use Scala CLI nightly (compare)
alexarchambault on sbt-main-line
Use sbt main line launcher on CI (compare)
alexarchambault on scala-cli
Switch build to Scala CLI (compare)
alexarchambault on scala-cli
Switch build to Scala CLI (compare)
alexarchambault on sbt-main-line
alexarchambault on master
Use sbt main line launcher on C… (compare)
alexarchambault on sbt-main-line
Use sbt main line launcher on CI (compare)
alexarchambault on scala-cli
Switch build to Scala CLI (compare)
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?
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?
mapN
LabelledGeneric
Hello. I am getting compiler "stackoverflow" when trying to derive generators for scalapb data.
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.scala$tools$nsc$typechecker$Implicits$ImplicitSearch$$typedImplicit(Implicits.scala:622)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$ImplicitComputation.rankImplicits(Implicits.scala:1213)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch$ImplicitComputation.findBest(Implicits.scala:1248)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.searchImplicit(Implicits.scala:1305)
at scala.tools.nsc.typechecker.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1730)
at scala.tools.nsc.typechecker.Implicits.inferImplicit1(Implicits.scala:112)
at scala.tools.nsc.typechecker.Implicits.inferImplicit(Implicits.scala:91)
at scala.tools.nsc.typechecker.Implicits.inferImplicit$(Implicits.scala:88)
at scala.tools.nsc.Global$$anon$5.inferImplicit(Global.scala:483)
at scala.tools.nsc.typechecker.Implicits.$anonfun$inferImplicit$1(Implicits.scala:144)
at scala.tools.nsc.typechecker.Implicits.inferImplicit(Implicits.scala:144)
at scala.tools.nsc.typechecker.Implicits.inferImplicit$(Implicits.scala:142)
at scala.tools.nsc.Global$$anon$5.inferImplicit(Global.scala:483)
at scala.reflect.macros.contexts.Typers.inferImplicitValue(Typers.scala:56)
at scala.reflect.macros.contexts.Typers.inferImplicitValue$(Typers.scala:54)
at scala.reflect.macros.contexts.Context.inferImplicitValue(Context.scala:18)
at scala.reflect.macros.contexts.Context.inferImplicitValue(Context.scala:18)
at shapeless.LazyMacros$DerivationContext$State$.resolveInstance(lazy.scala:303)
at shapeless.LazyMacros$DerivationContext.resolve0(lazy.scala:421)
at shapeless.LazyMacros$DerivationContext.$anonfun$deriveLowPriority$1(lazy.scala:449)
at scala.Option.flatMap(Option.scala:283)
at shapeless.LazyMacros$DerivationContext.helper$2(lazy.scala:446)
at shapeless.LazyMacros$DerivationContext.deriveLowPriority(lazy.scala:483)
at shapeless.LazyMacros$DerivationContext.derive(lazy.scala:494)
at shapeless.LazyMacros$DerivationContext$State$.deriveInstance(lazy.scala:327)
at shapeless.LazyMacrosCompat.deriveInstance(lazymacros.scala:50)
at shapeless.LazyMacrosCompat.deriveInstance$(lazymacros.scala:33)
at shapeless.LazyMacros$.deriveInstance(lazy.scala:573)
at shapeless.LazyMacros.mkImpl(lazy.scala:216)
at shapeless.LazyMacros.mkStrictImpl(lazy.scala:209)
at shapeless.LazyMacrosRef.mkStrictImpl(lazyref.scala:39)
at scala.reflect.macros.runtime.JavaReflectionRuntimes$JavaReflectionResolvers.$anonfun$resolveJavaReflectionRuntime$5(JavaReflectionRuntimes.scala:45)
Can I do something with this or I have big nested type that can not be derived?
-Xss2m