So far we’ve seen that ZIO Optics already provides lots of nice tools that developers can use to improve their productivity. However, ZIO Optics is still in the development stage, so there is even more great stuff coming in the future:
Dot syntax: Previously we have seen how ZIO Optics adds extension methods to the ZRef data type from ZIO. This allows us to work with nice dot syntax, like this:
ref.key("key").right.at(0).update(_ + 1)
In future releases, it should be possible to have a similar dot syntax for ordinary values, as shown in the ZIO Optics documentation:
val map: Map[String, Either[String, Chunk[Int]]] = ??? val updated: Either[OpticFailure, Map[String, Either[String, Chunk[Int]]]] = map.optic.key("key").right.at(0).update(_ + 1)
Moreover, when automatic derivation of optics is introduced, this syntax will be supported for user defined data structures as well.
More constructors and operators for Lens, Prism, Iso, Optional and Traversal.