Dispatch on Core.IntrinsicFunction


foo(::typeof(Core.Intrinsics.add_float)) = "add two floats"
foo(::typeof(Core.Intrinsics.add_int)) = "add two ints"

If you ask what methods of foo are available, you’ll see

julia> methods(foo)
# 1 method for generic function "foo":
[1] foo(::Core.IntrinsicFunction) in Main at REPL[3]:1

because (AFAICT) all the functions in Core.Intrinsics are of the same type – Core.IntrinsicFunction. This is different from your usual functions, for which the above would produce methods of foo specific to add_float and add_int.

Is there a way to achieve the same behaviour with IntrinsicFunctions as with regular functions?