Skip to content

Instantly share code, notes, and snippets.

@tixxit
Last active December 28, 2015 19:29
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 tixxit/7551058 to your computer and use it in GitHub Desktop.
Save tixxit/7551058 to your computer and use it in GitHub Desktop.
import scala.reflect.ClassTag
sealed trait Value
case class ValueArray[A](xs: Array[A])(implicit val ct: ClassTag[A]) extends Value
case class Text(value: String) extends Value
def doStuff(lit: Value): Unit = lit match {
case (al: ValueArray[a]) =>
implicit val ct = al.ct
val yay = new Array[a](2)
case _ =>
}
@oxbowlakes
Copy link

Shouldn't case (al: ArrayList[a]) be case (al: ValueArray[a]) and doStuff(lit: Lit) be doStuff(lit: Value)

@tixxit
Copy link
Author

tixxit commented Nov 20, 2013

Thanks! That's what I get for trying to change the type names right before gisting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment