A uniform approach to constraint-solving for lists, multisets, compact lists, and sets