if (val instanceof String) return "<html> <span" + c + encode((String)val) + "</span></html>";
if (val instanceof Pair) return "<html> <b" + c + "field " + encode(((ExprHasName)(((Pair<?,?>)val).b)).label) + "</b></html>";
if (val instanceof A4Tuple) {
StringBuilder sb = new StringBuilder("<html> <span" + c);
A4Tuple tp = (A4Tuple) val;
for(int i=1; i<tp.arity(); i++) {
if (i>1) sb.append(" -> ");
sb.append(encode(tp.atom(i)));
}
sb.append("</span></html>");
return sb.toString();