toplevel, codegen, bindings: introduce type tag in value_t