I'll give this a try, but I'm not sure everything will be supercorrect or anyway clear.

Premise

The first point to address is that a function from type T to result R ( T => R ) is covariant in its return type and contravariant in its parameters: i.e. Function[-T, +R] .

To make it short it means that for function fsub to be a subtype of function f its return type must be the same type or a subtype of R (covariant) and its parameter must be the same or a supertype of T (contravariant).

Let's try to make sense of this: if you want to be able to use fsub where a f is expected (see Liskov), you need an fsub that can handle at most a passed argument of T , but nothing more specific, because that's what the callers of f are expected to pass to it. Moreover, since a T will be passed, you can be more relaxed on the parameters for your fsub and handle one of its supertypes, since every T passed to it is also an instance of its supertypes.

This is what is meant when we say that a function's argument is contravariant in its type: it tells you how its type can change in relationship subtyping the function as a whole, or actually the other way round.

Given this, let's get back to the specific case. The handler's mutator ( onMouseClicked_= ) should at least accept a lambda of type MouseEvent => Unit . Let's give it a name, handler: MouseEvent => Unit .

But it doesn't end here, you should expect to be able to pass the method a subtype of this lambda, and what will the type of this "subfunction" be? As we said before it could accept a MouseEvent or any supertype of it, then subhandler: T => Unit with T :> MouseEvent .

And that's exactly the general form of the method you saw.

Conclusion