trait
ImplicitApply[F] extends Serializable
Type Members
-
abstract
type
Out
Abstract Value Members
-
abstract
def
apply(f: F): Out
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
def
+(other: String): String
-
-
final
def
==(arg0: Any): Boolean
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
-
-
-
-
-
-
def
finalize(): Unit
-
def
formatted(fmtstr: String): String
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
final
def
isInstanceOf[T0]: Boolean
-
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
-
A dependent type class that invokes
F
with implicit values as parameters.Imports
import com.thoughtworks.feature.ImplicitApply.ops._
This will enable the implicitApply method for any functions
Author:
杨博 (Yang Bo) <[email protected]>
The function type to be implicitly invoked
Given a function
f
that requires anOrdering[Int]
Then
f
can implicitly apply as long as its parameter is implicitly available,f.implicitApply should be("OK")
Given a function
f
that requires an call-by-nameOrdering[Int]
Then
f
can implicitly apply as long as its parameter is implicitly available,f.implicitApply should be("OK")
You can optionally add an implicit modifier on the function parameter.
It is very useful when you create a curried function.