Skip to content

Commit

Permalink
simpler, more green
Browse files Browse the repository at this point in the history
  • Loading branch information
mcabbott committed Jun 8, 2022
1 parent d39d1c3 commit 60d5a98
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,10 @@ Broadcast.materialize(x::Lazy) = Broadcast.instantiate(x.bc)
onevalue::T, x::AbstractArray{T}) where T = map(_ -> λ, x)
onevalue(λ, x::AbstractArray{T}) where T = onevalue(convert(float(T), λ), x)

function Base.show(io::IO, ℓ::Leaf) # show method is mostly to hide its long type!
function Base.show(io::IO, ℓ::Leaf)
ioc = IOContext(io, :compact => true)
printstyled(io, "Leaf("; color = :green)
show(ioc, ℓ.rule)
printstyled(", "; color = :green)
str = sprint(show, ℓ.rule; context = ioc)
printstyled(io, "Leaf(", str, ", "; color = :green)
str = sprint(show, ℓ.state; context = ioc)
print(io, length(str) < 70 ? str : first(str, 50) * "")
printstyled(io, ")"; color = :green)
Expand Down

0 comments on commit 60d5a98

Please sign in to comment.