-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for cats 0.8.0 #59
Comments
Yes, you're absolutely correct. I'm actually working on that as we speak, but it forces other issues to the front: I need to upgrade to more recent versions of scalacheck and discipline, which break a lot of things. But yes, that's what's driving the next release and it's at the top of the list of priorities. |
Managed to reduce to: import org.scalacheck._
import org.scalacheck.derive._
import org.scalatest.FunSuite
import org.scalatest.prop.GeneratorDrivenPropertyChecks
class Testor extends FunSuite with GeneratorDrivenPropertyChecks
with DerivedInstances
{
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]
type T = Unit ⇒ Float Or Boolean
test("Rep again") {
var good: Int = 0
var bad: Int = 0
var caught: Throwable = null
val frall = Prop.forAll({
(a: T) =>
try {
a(())
good = good + 1
}
catch {
case e: Throwable =>
bad = bad + 1
caught = e
}
Prop(true)
})
frall.main(Array.empty)
info(s"Good = ${good}, Bad = ${bad}")
throw caught
}
}
|
Changing to: sealed trait Or[+A, +B] extends Product with Serializable
case class Left[A, B](a: A) extends Or[A, B]
case class Right[A, B](b: B) extends Or[A, B] Fixes this for some reason. Do you necessarily needs the Nothing's? |
Just looking at the cats, they moved it all to Scala's Either. |
Thanks a lot for the test cases, I need to look into them as soon as possible. As or cats having moved to |
Good news. Reduced the test case further. import org.scalacheck._
import org.scalacheck.derive._
import org.scalacheck.rng.Seed
import org.scalatest.FunSuite
import org.scalatest.prop.GeneratorDrivenPropertyChecks
class Testor extends FunSuite with GeneratorDrivenPropertyChecks
with DerivedInstances {
sealed trait Or[+A, +B]
final case class Right[B](b: B) extends Or[Nothing, B]
type T = Unit ⇒ Float Or Boolean
test("Better test case") {
val arb = implicitly[Arbitrary[T]].arbitrary
arb.doPureApply(Gen.Parameters.default.withSize(0), seed = Seed.random(), retries = 0)
.retrieve.get.apply(())
}
} Output:
build.sbt for anyone: resolvers += Resolver.sonatypeRepo("releases")
libraryDependencies += "com.github.alexarchambault" %% "scalacheck-shapeless_1.13" % "1.1.3"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.0" % "test"
scalaVersion := "2.11.8" When generation size is 0 then Gen.fail is used. I'm not sure what is the purpose of this is so far. Here's the specific line of code. So:
|
Maybe @alexarchambault has something to say? |
@nrinaudo that should be a sufficient solution |
It would be, but it doesn't actually work - yet. I might be doing something wrong. Or, alternatively, if @alexarchambault intends to fix that at the |
Of particular interest, this means: - upgrading to cats 0.8.0 (#59) - upgrading to scalacheck 1.13.
0.1.16-SNAPSHOT is being published as I type this and has support for cats 0.8.0. |
Note that I'm waiting on #58 before releasing 0.1.16. It's just a matter of time - I'm still waiting for a typelevel cats 2.12.0 build, which I believe is ready and just needs to be published. |
What resolver should I use? Doesn't work for me. |
@ScalaWilliam ah, yes, not everyone has sonatype-snapshots enabled by default :) This is what you need: scalaVersion := "2.11.8"
resolvers := Seq(Resolver.sonatypeRepo("snapshots"))
libraryDependencies += "com.nrinaudo" %% "kantan.csv" % "0.1.16-SNAPSHOT" |
Xor is gone in cats 0.8.0.
typelevel/cats#1310
AFAIK kantan.csv-cats uses Xor, so migration to Either is needed.
The text was updated successfully, but these errors were encountered: