It seems to work at 0.5
julia> typeof(a) Array{Float64,1} julia> (typeof(a).name.primary)([1 2 3]) 1×3 Array{Int64,2}: 1 2 3
Change 1:
Thanks to the thick comment and ColorTypes.jl package ColorTypes.jl solution for 0.6:
julia> (typeof(a).name.wrapper)([1 2 3]) 1×3 Array{Int64,2}: 1 2 3
Edit 2:
Fanyang Wang convinced me that using typename necessary. In particular, Array{Int}.name fails by 0.6 because Array{Int} now of type UnionAll . Definition working on 0.5 and 0.6,
using Compat.TypeUtils: typename if :wrapper in fieldnames(TypeName) parameterless_type(T::Type) = typename(T).wrapper else parameterless_type(T::Type) = typename(T).primary end parameterless_type(x) = parameterless_type(typeof(x))
Wherein
parameterless_type([0.1,0.2,0.3]) == Array parameterless_type(Array{Int}) == Array
source share