Summary
In this chapter, we looked at data access in deeply nested data structures. We saw how updating fields with the built-in record
field functionality is awkward. As an alternative, we introduced lenses as first-class, easily composable data accessors. We saw that they not only allow purely functional updates of record fields but also support virtual fields and side effects. Moreover, besides focusing on one field, they can also focus on multiple fields or values at once.
Chapter 16, Property-Based Testing, concludes this book with another viral idea that was developed in the context of Haskell: property-based testing. It is a powerful alternative to ordinary unit testing. The idea is to not write unit tests manually but generate them automatically from a more high-level description – a property. From most properties, an unbounded number of unit tests can be automatically generated, either randomly or more systematically. This makes testing more thorough and fun.
...