Created
April 13, 2015 08:05
-
-
Save alexarchambault/90f79a160eca9a9e6932 to your computer and use it in GitHub Desktop.
Ammonite PPrint derivation failing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] ^ | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object ObjDefinitions { | |
case class Foo(i: Int, s: String) | |
} | |
class ClsDefinitions { | |
case class Foo(i: Int, s: String) | |
} | |
object ClsDefinitions extends ClsDefinitions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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