Tofu optics
Installation
"tf.tofu" %% "tofu" % tofu-version
or as standalone dependencies:
"tf.tofu" %% "tofu-optics-core" % tofu-version
"tf.tofu" %% "tofu-optics-macro" % tofu-version
"tf.tofu" %% "tofu-optics-interop" % tofu-version
Functionality
Tofu contains its own optics library with some notable features:
- subtyping: You don't need to convert more powerful optic to weaker one
- unified composition operator
Hierarchy
Intuition
If you ever used lens optics' names will be quite familiar to you,
but for a Monocle user Tofu
's naming may be confusing. The following table may clear things up:
Monocle | tofu |
---|---|
Iso | Equivalent |
Prism | Subset |
Lens | Contains |
Optional | Property |
Traversal | Items |
Getter | Extract |
Fold | Folded |
Setter | Update |