Given a concrete type, one can define functor-like methods with:
struct Foo end (f::Foo)(x) = 2x
and use the object as a function:
f = Foo() f(1)
This doesn’t work with abstract types, however; even though they support abstract methods:
abstract type A end iscool(::A) = false # works just fine (::A)(x) = 2x # fails, cannot add method to abstract type
Is there any way to define functor-like abstract types? I am just trying to avoid typing the same function for all subtypes of the abstract type manually.