diff --git a/NDTensors/src/lib/GradedAxes/src/labelledunitrangedual.jl b/NDTensors/src/lib/GradedAxes/src/labelledunitrangedual.jl index 98923733ab..256cd3f77d 100644 --- a/NDTensors/src/lib/GradedAxes/src/labelledunitrangedual.jl +++ b/NDTensors/src/lib/GradedAxes/src/labelledunitrangedual.jl @@ -24,14 +24,12 @@ end # fix ambiguities Base.getindex(a::LabelledUnitRangeDual, i::Integer) = dual(nondual(a)[i]) -function Base.show( - io::IO, ::MIME"text/plain", a::Union{LabelledUnitRange,LabelledUnitRangeDual} -) +function Base.show(io::IO, ::MIME"text/plain", a::LabelledUnitRangeDual) println(io, typeof(a)) return print(io, label(a), " => ", unlabel(a)) end -function Base.show(io::IO, a::Union{LabelledUnitRange,LabelledUnitRangeDual}) +function Base.show(io::IO, a::LabelledUnitRangeDual) return print(io, nameof(typeof(a)), " ", label(a), " => ", unlabel(a)) end diff --git a/NDTensors/src/lib/LabelledNumbers/src/labelledunitrange.jl b/NDTensors/src/lib/LabelledNumbers/src/labelledunitrange.jl index 03965f62f5..4f432c9226 100644 --- a/NDTensors/src/lib/LabelledNumbers/src/labelledunitrange.jl +++ b/NDTensors/src/lib/LabelledNumbers/src/labelledunitrange.jl @@ -52,3 +52,12 @@ function Base.iterate(a::LabelledUnitRange, i) next = convert(eltype(a), labelled(i + step(a), label(a))) return (next, next) end + +function Base.show(io::IO, ::MIME"text/plain", a::LabelledUnitRange) + println(io, typeof(a)) + return print(io, label(a), " => ", unlabel(a)) +end + +function Base.show(io::IO, a::LabelledUnitRange) + return print(io, nameof(typeof(a)), " ", label(a), " => ", unlabel(a)) +end