trie: support different key types