func dumpJSON(name string, v cue.Value, flag dumpFlag) {
	whole := map[string]interface{}{
		name: assembleValues(v, flag, 0),
	}
	b, err := json.MarshalIndent(whole, "", "  ")
	if err != nil {
		panic(err)
	}
	fmt.Fprint(jf, string(b))
}
Exercises all read-only funcs on a cue.Value.

For great grokking, because the underlying datastructures are too complex to
grasp directly.
package cuetsy
import (
	"encoding/json"
	"fmt"
	"io"
	"io/ioutil"
	"os"
	"cuelang.org/go/cue"
	"cuelang.org/go/cue/ast"
)
var jf io.Writer = ioutil.Discard
func init() {
}
type dumpFlag uint64
const (
	dumpErrs dumpFlag = 1 << iota
	dumpRef
	dumpAttrs
	dumpSource
	dumpKind
	dumpIncompleteKind
	dumpExpr
	dumpBool
	dumpBytes
	dumpDefault
	dumpDocs
	dumpErr
	dumpEval
	dumpExists
	dumpStruct
	dumpString
	dumpInt
	dumpInt64
	dumpUint64
	dumpFloat64
	dumpIsClosed
	dumpIsConcrete
	dumpLabel
	dumpList
	dumpNull
	dumpPath
)
const (
	hdumpVals = dumpString | dumpInt | dumpInt64 | dumpUint64 | dumpFloat64 | dumpStruct
	hdumpRefs = dumpExpr | dumpRef | dumpStruct | dumpPath | dumpString | dumpAttrs
	hdumpTyp  = dumpExpr | dumpKind | dumpIncompleteKind
)
func prepdump() {
	var err error
	jf, err = os.OpenFile("dump.json", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0755)
	if err != nil {
		panic(err)
	}
}