Open
Description
Currently, we have (as of HEAD
right now):
$ cabal new-run exe:dhall -- diff '[1, 2, 3, 4]' '[1, 3, 4, 5]'
[ …
, - 2
, …
, + 5
]
I think we can do better. I think certainly for lists, we should add "context" which can be some sibling nodes, perhaps only one level of pretty printing:
$ cabal new-run exe:dhall -- diff '[1, 2, 3, 4]' '[1, 3, 4, 5]'
[ 1
, - 2
, 3
, 4
, + 5
]
I reach that diff by finding each …
, and then adding the expression before and after the node.
In terms of the recursion, we want to avoid printing huge expressions. The idea of printing "just one level" would mean:
cabal new-run exe:dhall -- diff '{ x = if True then 1 else 2, y = 4 }' '{ x = if True then 1 else 2, y = 5 }'
{ y = - 4
+ 5
, …
}
would be
cabal new-run exe:dhall -- diff '{ x = if True then 1 else 2, y = 4 }' '{ x = if True then 1 else 2, y = 5 }'
{ x = if … then … else …
, y = - 4
+ 5
}
(this adds x =
as context for the diff, and summarises it).