Lenses can simplify test assertions when working with nested record types in Haskell. The article demonstrates refactoring awkward test code that updates nested data structures using the lens library's operators like `%~`, `-~`, and `.~`. By composing setters for nested fields, tests become more readable and can make stronger
•8m read time• From blog.ploeh.dk
Table of contents
Weak tests #Replacing Pair with both #Strengthening assertions the hard way #Setting an inner value #Composing setters #Combinator golf #Conclusion #Sort: