Is it possible to extract a type parameter from a supertype?
In the example below, I want a function that takes a subtype of A, like B,
and returns N.
julia> abstract A{N}
julia> type B{N} <: A{N} end
julia> function foo{N, T<:A{N}}(::Type{T}) N end
ERROR: N not defined
Obviously, I could use
julia> function foo{N}(::Type{B{N}}) N end
but that's specific to just one subtype. While
julia> function foo{N}(::Type{A{N}}) N end
is too specific (doesn't match foo(B).
Is there any way I've missed?
Thanks,
Andrew