improve readability of diff
The readability of the diffs has to be improved to make them workable for the complex and large values. I'll work on this, but let's first discuss the points @cstaps. I hope that everything can be done by providing an adapted version of diffToConsole :: [Diff] -> String
.
As a starting point consider this property: [1,2,3] =.= [1,0,3]
. The output currently is:
~(_Cons
1
~ (_Cons
- 2
+ 0
(_Cons
3
_Nil
)
~ )
~)
- The +/- do not make much sense. I want to know which values are present at the left and which at the right side. I suggest using >/<.
~(_Cons
1
~ (_Cons
< 2
> 0
(_Cons
3
_Nil
)
~ )
~)
- The closing brackets do not add much, because we already use indentation to show scope. The problem is that they waste a line. For large values a more compact view is preferable.
~_Cons
1
~ _Cons
< 2
> 0
_Cons
3
_Nil
- This is obviously not ideal for lists. Not sure whether we need a more general solution for specific data structures, but for lists I really need something on short term, as they are so commonly used. A dirty solution would be to match the constructor names and do something different for lists in
diffToConsole
. But maybe it's better to extendgDiff
?
A possible proposal of how to print this, which avoids using a closing ] on a separate line:
~[]
1
< 2
> 0
3