External Publication
Visit Post

What is the most ergonomic library to diff data structures in a test suite these days?

Haskell Community [Unofficial] April 28, 2026
Source

I have experimented with generic-diff recently with some level of success. As the name implies, it is based on generics, so you can derive a few instances and start using it right away with no additional boilerplate. It also ships with special diffing logic for some common container types (e.g. Map and Set) that provide nicer diff outputs compared to what you would have with just the generics-based instances. For my use case, one shortcoming of the library that ultimately didn’t allow me to fully substitute it with our in-house solution is that in the case where two values are structurally the same but have different values (e.g. just two Ints with different values) the diff output just reports them as “not equal”, and does not display the actual values. I attempted to add the said functionality but ultimately failed, possibly due to my lack of understanding of generics-sop.

The announcement post of the library by @fpringle from a year ago might also be of interest: Generic-diff: generic structural diffs

Discussion in the ATmosphere

Loading comments...