Created
June 1, 2015 16:16
-
-
Save maizy/c1839bd6d235cc656349 to your computer and use it in GitHub Desktop.
Anonymous func from method with implicit params?
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
$ scala | |
Welcome to Scala version 2.11.5 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_67). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> class MyContext2(val m: Int) | |
defined class MyContext2 | |
scala> object TestObj2{ def withImp(s: String)(implicit c: MyContext2): String = s"c:${c.m}" } | |
defined object TestObj2 | |
scala> val func = TestObj2.withImp _ | |
<console>:9: error: could not find implicit value for parameter c: MyContext2 | |
val func = TestObj2.withImp _ | |
^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Пока придумал только
но хочется оставить анонимный метод с implicit параметром. хотя кажется это не возможно.