Accessors.jl icon indicating copy to clipboard operation
Accessors.jl copied to clipboard

nicer show for optics

Open aplavin opened this issue 1 year ago • 0 comments

Optics already show quite nicely in many cases, with a major exception of operators. Here, I make operators display nicer, while staying conservative to ensure robust show-parse roundtrip:

julia> @o _.a + 1
(@o +(_.a, 1)) # before
(@o _.a + 1) # after

julia> @o _.a*2 + 1
(@o +(*(_.a, 2), 1)) # before
(@o (_.a * 2) + 1) # after

Most useful whenever optics are a part of the user-facing interface (can even be plot labels!), but for internal debug/inspection as well.

aplavin avatar Jul 02 '24 19:07 aplavin