以下の作品:
object X extends (Int => String => Long) {
def apply(x:Int):String => Long = ???
}
パラメータを使用してapply
関数を入力するにはどうすればよいですか?implicit
私は次の方法を持っています:
def apply(x:Int)(implicit y:String):Long = ???
関数の種類はどのように記述すればよいですか?
object X extends <functionType> {
def apply(x:Int)(implicit y:String):Long = ???
}
アップデート
次のように定義できます。
object X extends (Int => String => Long) {
def apply(x:Int):(String => Long) = ???
def apply(x:Int)(implicit y:String):Long = ???;
}
しかし、それを呼び出しても機能しません:
error: ambiguous reference to overloaded definition,
both method apply in object X of type (x: Int)(implicit y: String)Long
and method apply in object X of type (x: Int)String => Long
match argument types (Int)
X(3)
^