Text this: Generic Programming for Indexed Datatypes