I skipped haskell the convenient $ operator, so I decided to enter it.
class Applayable[-R,T] (val host : Function[R,T]) { def $: R=>T = host.apply } implicit def mkApplayable[R,T] (k : Function[R,T]) : Applayable[R,T] = new Applayable(k)
It worked correctly for
val inc : Int => Int = _ + 1 inc $ 1
but failed to execute
def inc(x:Int) : Int = x+1 inc $ 1
What type should I specify for implicit conversion in order to convert the definition of def to an instance of Applayable?
source share