Specify type of function


#1

Let’s say that I want to write a higher order function (a function that accepts another function) I know I can accept it like:

fun(f::Function, args...) = ...

What I want to know if it is possible to be more specific about the type of f, if I expect the function to have a certain format, for example a predicate function would need to accept two values of a special type and return a Bool. Something like:

fun(f::(x1::T, x2::T)::Bool, Vector{T}) where T = ...

If this is not currently possible I think it would be a nice feature request.


#2

You can check this comment and the rest of the thread:


#3

Ah nice! Thank you! :smiley: