Skip to content

Instantly share code, notes, and snippets.

@pjrt
Last active August 29, 2015 14:23
Show Gist options
  • Save pjrt/40c06d8b749716d3726e to your computer and use it in GitHub Desktop.
Save pjrt/40c06d8b749716d3726e to your computer and use it in GitHub Desktop.
numeric widen on the implicit system
trait T[A]
object Main {
implicit val doubleInst: T[Double] = new T[Double] {}
def f[A](a: A)(implicit ev: T[A]): T[A] = ev
f(1: Int)
f(1: Float)
f(1: Double)
}
@pjrt
Copy link
Author

pjrt commented Jun 22, 2015

Numeric Widen does not extend to the implicit system (it seems). Good :D

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