Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- scala> :paste
- class :=[T,Q]
- trait Default_:={
- /** Ignore default */
- implicit def useProvided[Provided,Default] = new :=[Provided,Default]
- }
- object := extends Default_:={
- /** Infer type argument to default */
- implicit def useDefault[Default] = new :=[Default,Default]
- }
- scala> def foo[T](implicit default: T := Int, ct: reflect.ClassTag[T]) = ct.toString
- scala> foo
- res0: String = Int
- scala> foo[String]
- res1: String = java.lang.String
Advertisement
Add Comment
Please, Sign In to add comment