How to get methods of functor?

How to get methods of functor?

julia> foo() = 2;
julia> foo(x) = x + 2;
julia> methods(foo)
# 2 methods for generic function "foo":
[1] foo() in Main at REPL[21]:1
[2] foo(x) in Main at REPL[22]:1
julia> struct Foo x end;
julia> (obj::Foo)() = obj.x;
julia> (obj::Foo)(x) = obj.x + x;
julia> methods(Foo)
# 1 method for type constructor:
[1] Foo(x) in Main at REPL[1]:1
julia> foo = Foo(2);
julia> methods(foo)
# 2 methods for callable object:
[1] (obj::Foo)() in Main at REPL[1]:1
[2] (obj::Foo)(x) in Main at REPL[2]:1
1 Like