Setfield.jl
Setfield.jl copied to clipboard
Use JuliaFunctional/CompositionsBase.jl?
I created https://github.com/JuliaFunctional/CompositionsBase.jl so that packages dealing with morphisms can share symbols like ⨟
, compose
, and opcompose
(an ASCII alias of ⨟
). As we discussed in https://github.com/tkf/Transducers.jl/issues/67, my motivation is to use this from Transducers.jl. Do you want to use it from Setfield?
I also invited you to the organization so that you can tweak CompositionsBase.jl directly if you need to. Do you want to co-maintain it?
Thanks for the invite, I am happy to co-maintain it. What do you mean by
Do you want to use it from Setfield?
As I understand, the operations in CompositionBase.jl
are all derived from ∘
? So they automatically work on lenses without any extra code needed in Setfield.jl?
Ah, I forgot that Setfield.jl didn't export compose
.
So, you are right, there is no need for Setfield.jl to import CompositionsBase.jl (unless you want to re-export compose
etc.)
There is one subtle point. Setfield.compose()
is a lense, while CompositionBase.compose()
throws an error. Its a bit awkward. We could rename Setfield.compose
into e.g. lenscompose
and reexport CompositionBase
if you like.
Setfield.compose()
is a lense
Ah, good point. Well, if nobody asked to export this function, I think it's OK to keep it like this. Though probably a super careful approach is to use lenscompose
so that it is possible to re-export CompositionsBase.compose
from the top-level namespace at some point.