-
Notifications
You must be signed in to change notification settings - Fork 0
Description
While rendering the diff error, I believe it will much more useful to also include the differing values in the error message. Going with the example used in the docs, I have something like the following in mind:
ghci> printDiffResult $ diff expr1 expr2
In field right:
Both values use constructor Bin but fields don't match
In field right:
Both values use constructor Atom but fields don't match
In field 0 (0-indexed):
Not equal
Left value: 1
Right value: 2Of course this requires us to capture the two values as part of the TopLevelNotEqual constructor. I have actually hacked something together that works, but the main issue is that we now need the type in question to have Eq and Show instances. In my implementation I have added those constraints to the GADT declaration directly, but that required me to remove some Diff instances from the library, since not all the types we currently have Diff instances for have a Show instance by default (e.g. MVar, along with many others). It might be possible to workaround this by not adding those constraints to the GADT itself, but push them up to the rendering functions. Since I don't readily know much about generics-sop myself, I first wanted to ask if this is a good idea at all, or whether it was a deliberate choice to not go this route.