Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

2 Commits

Repository files navigation

Introduction to the Java Optics

Functional Optics for Modern Java series

Part 1. The Immutability Gap: Why Java Records Need Optics

Part 2. Optics: Lenses, Prisms, and Traversals in Practice

Useful links:

JEP 468. Derived Record Creation

Runnable Demos on GitHub.


 ┌─────────┐
│ Fold │ (read-only, zero-or-more)
└────┬────┘
│
┌──────────┴──────────┐
│ │
┌────┴────┐ ┌─────┴─────┐
│ Getter │ │ Traversal │ (read-write, zero-or-more)
└────┬────┘ └─────┬─────┘
│ │
│ ┌─────┴─────┐
│ │ │
┌────┴────┐ ┌─────┴─────┐ ┌───┴───┐
│ Lens │ │ Affine │ │Setter │
└────┬────┘ └─────┬─────┘ └───────┘
│ (zero-or-one)
│ │
│ ┌─────┴─────┐
│ │ Prism │
│ └─────┬─────┘
│ │
└───────┬───────┘
┌────┴────┐
│ Iso │ (exactly-one, reversible)
└─────────┘

Further reading: Higher-Kinded-J. Composable Effects and Advanced Optics for Java

About

Introduction to the Java Optics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages