func Diff(v1, v2 types.Value, dChan chan<- Difference, stopChan chan struct{}, leftRight bool) {
	d := differ{diffChan: dChan, stopChan: stopChan, leftRight: leftRight}
	if !v1.Equals(v2) {
		if !shouldDescend(v1, v2) {
			d.sendDiff(Difference{Path: nil, ChangeType: types.DiffChangeModified, OldValue: v1, NewValue: v2})
		} else {
			d.diff(nil, v1, v2)
		}
	}
}
Diff traverses two graphs simultaneously looking for differences. It returns
two channels: a DiffReceiveChan that the caller can use to iterate over the
diffs in the graph and a StopSendChanel that a caller can use to signal the
Diff function to stop processing.
Diff returns the Differences in depth-first first order. A 'diff' is defined
as one of the following conditions:
* a Value is Added or Removed from a node in the graph
* the type of a Value has changed in the graph
* a primitive (i.e. Bool, Number, String, Ref or Blob) Value has changed

A Difference is not returned when a non-primitive value has been modified. For
example, a struct field has been changed from one Value of type Employee to
another. Those modifications are accounted for by the Differences described
above at a lower point in the graph.

If leftRight is true then the left-right diff is used for ordered sequences
- see Diff vs DiffLeftRight in Set and Map.

Note: the function sends messages on diffChan and checks whether stopChan has
been closed to know if it needs to terminate diffing early. To function
properly it needs to be executed concurrently with code that reads values from
diffChan. The following is a typical invocation of Diff():
dChan := make(chan Difference)
sChan := make(chan struct{})
go func() {
d.Diff(s3, s4, dChan, sChan, leftRight)
close(dChan)
}()
for dif := range dChan {
<some code>
}
package diff
import (
	"github.com/attic-labs/noms/go/types"
)
type (
	diffFunc     func(changeChan chan<- types.ValueChanged, stopChan <-chan struct{})
	pathPartFunc func(v types.Value) types.PathPart
	valueFunc    func(k types.Value) types.Value
)
type Difference struct {
	Path types.Path
	ChangeType types.DiffChangeType
	OldValue types.Value
	NewValue types.Value
	NewKeyValue types.Value
}
func (dif Difference) IsEmpty() bool {
	return dif.Path == nil && dif.OldValue == nil && dif.NewValue == nil
}
type differ struct {
	diffChan chan<- Difference
	stopChan chan struct{}
	leftRight bool
}