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

Use JuliaFunctional/CompositionsBase.jl?

Open tkf opened this issue 4 years ago • 4 comments

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?

tkf avatar May 30 '20 19:05 tkf

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?

jw3126 avatar May 30 '20 21:05 jw3126

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.)

tkf avatar May 30 '20 21:05 tkf

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.

jw3126 avatar May 30 '20 22:05 jw3126

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.

tkf avatar May 30 '20 22:05 tkf