Let’s suppose that you’re me: a person who’s decided, for perhaps silly reasons, to write a package – let’s call it Lens2
– that is to be mostly backwards compatible with another one – call it Lens
.
Existing Lens
client code refers to the top-level package without aliases, as with Lens.key(:a)
. Clients of Lens2
can do the same, so long as use Lens2
is added to the module (because it contains alias Lens2.Lenses, as: Lens
).
However, there’s a third-party package, TypedStructLens
, that also makes direct references to Lens
. It’s a super-simple package, so it’s trivial to copy and tweak it to work with Lens2
, but it made me wonder:
Is there some magic where you can say, at “link time” or “symbol resolution time”: replace references to module Lens
with Lens2.Lenses
?