Parametric abstract types

You should make the type parameter part of the abstract type. e.g.

abstract type MyAbstractType{T} end
struct MyConcreteType1{T} <: MyAbstractType{T}
    ...
end

then you can do

function fun(x::MyAbstractType{U}, y::MyAbstractType{V}) where {U<:AbstractFloat, V<:AbstractFloat}
end

and it will match instances of your concrete type.

2 Likes