Add ability to declare pattern matched values as implicit

A related thing that would be nice is if you could import non-implicit definitions as implicit.

For example, if you wanted Numeric.BigDecimalAsIfIntegral in scope as an implicit, you would normally need to do:

def foo[A: Integral](a: A) = ???

import scala.math.Numeric.BigDecimalAsIfIntegral

implicit val integral = BigDecimalAsIfIntegral
foo(BigDecimal(0.0))

but instead you could do:

def foo[A: Integral](a: A) = ???

import implicit scala.math.Numeric.BigDecimalAsIfIntegral

foo(BigDecimal(0.0))

(Disallowing importing wildcards as implicits might also be good idea, for sanity reasons.)

3 Likes