A nonparametric HMM for genetic imputation and coalescent inference