Mark Seemann 2/9/2026

Simplifying assertions with lenses

Read Original

This technical article discusses a common problem in software testing: writing weak or awkward assertions for nested record types. Using Haskell as an example, it demonstrates how the lens library, specifically the 'both' function, can be used to create more precise and readable test comparisons, moving beyond simple equality checks to target specific parts of complex data.

Simplifying assertions with lenses

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week