bits of generic programming. almost finished general type constraints.