Skip to content

Draft: Add a Foldable UniqDSet instance

Richard Eisenberg requested to merge wip/foldable-uniqdset into master

I needed this instance in another patch, but I wanted to make sure this got the scrutiny it deserves.

Three questions we need answered before this can be merged:

  1. Is this instance sound? That is, are all invariants respected?
  2. Is this instance performant? Is implementing just foldr enough to get good behavior?
  3. Is this instance a good idea, style-wise?

My answers:

  1. It seems so, because Foldable consumes only. But I somehow want a double-check.
  2. I have no idea.
  3. I think so. Foldable unlocks a number of useful coding patterns, and I'd like to use them.
Edited by Andreas Klebinger

Merge request reports