Folds for extracting unique elements

I'm not sure about the strictness guarantees. Please review.