I was looking through some of my github repos, and I realized that I never wrote a blog post on my Rust library myopic. This library is available on crates.io.

This library implements a simple very of the concept of a functional lens. If you want a fully featured lense library, see lens, a good discussion of lenses at lens over tea, or perhaps a profunctor lense is more your speed?

Myopic is not one of these libraries- it is not a good lense. I tried to used some of the other lense libraries in Rust, but I found that they often assume that you either want pure functions (returning a new instance of the larger structure), or assuming that it is possible to get a mutable reference to a substructure. I wanted to be able to modify a piece of a structure without assuming that the structure actually contains the smaller structure. For example, if I wanted to modify a few bits within a byte, there is no referencing the individual bits, and if I wanted to provide a kind of "virtual" substructure I can't provide a real reference.

Myopic was intended to be used within a Genetic Algorithm library. Maybe one day I will clean up this library and post it- it contains an implementation of Robust Gene Expression Programming and some Genetic Algorithm stuff in a composable way.

Thats about all- I just wanted to point to this little library since I'm proud of my Rust libraries. It may not be of help to anyone, but the github repo contains some discussion and performance notes about different approaches if you are really interested.