Skip to content

Instantly share code, notes, and snippets.

@alexarchambault
Created April 13, 2015 08:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexarchambault/90f79a160eca9a9e6932 to your computer and use it in GitHub Desktop.
Save alexarchambault/90f79a160eca9a9e6932 to your computer and use it in GitHub Desktop.
Ammonite PPrint derivation failing
import ammonite.pprint._, Config.Defaults._
object AmmonitePPrintTest extends App {
println(PPrint(ObjDefinitions.Foo(2, "ab")).mkString)
println(PPrint(ClsDefinitions.Foo(2, "ab")).mkString)
}
/*
Fails with Ammonite 0.2.7, and more recent dev versions too
[error] .../AmmonitePPrintTest.scala:5: could not find implicit value for evidence parameter of type ammonite.pprint.PPrint[ClsDefinitions.Foo]
[error] println(PPrint(ClsDefinitions.Foo(2, "ab")).mkString)
[error] ^
*/
scalaVersion := "2.11.6"
resolvers ++= Seq(
Resolver.sonatypeRepo("releases"),
Resolver.sonatypeRepo("snapshots")
)
libraryDependencies ++= Seq(
"com.github.alexarchambault" %% "scalacheck-shapeless_1.12" % "0.2.0-SNAPSHOT",
"com.lihaoyi" %% "ammonite-pprint" % "0.2.7"
)
object ObjDefinitions {
case class Foo(i: Int, s: String)
}
class ClsDefinitions {
case class Foo(i: Int, s: String)
}
object ClsDefinitions extends ClsDefinitions
import org.scalacheck._, Shapeless._
object ShapelessTest extends App {
val o = Arbitrary.arbitrary[ObjDefinitions.Foo]
val c = Arbitrary.arbitrary[ClsDefinitions.Foo]
for (i <- 1 to 10)
println(o.sample)
for (i <- 1 to 10)
println(c.sample)
}
/*
Succeeds with shapeless 2.2.0-RC4 (through scalacheck-shapeless 0.2.0-SNAPSHOT)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment