I created following code snippet:
class PimpToRight[A](f: A => Boolean) {
def <| (a: A) = f(a)
}
implicit def f2pimp[A](f: A => Boolean) = new PimpToRight(f)
class PimpToLeft[A](a: A) {
def <|: (f: A => Boolean) = f(a)
def |> (f: A => Boolean) = f(a)
}
implicit def a2pimp[A](a: A) = new PimpToLeft(a)
There are right- and left-associative methods available.
Following code works:
((_: Int) > 3) <| 7
((_: Int) > 3) <|: 7
7 |> (_ > 3)
But this does not:
(_ > 3) <| 7
(_ > 3) <|: 7
Is it possible to infer type parameters from right to left?
These two issues are related: SI-4773 and SI-1980. Based on these issues, the answer to your question seems to be no. While not directly related to your question, there is a very nice post by Paul Chiusano on making the most of type inference in Scala, which addresses the current state of type inference in Scala and provides some useful advice.