ocaml-batteries-team/batteries-included — pull request #570 by cakeplus (2014-05-19 12:07:02+00:00)
Title: Fix: Enum.uniq should use structural comparison

Strangely, `Enum.uniq` uses physical comparison.

The behavior was documented not long ago (affdfcfddef9d5774511492165a5f8673ad94c5e), and I was fortunate enough to get burned by it in production code.

Can anyone elaborate on why does it need to use physical comparison? The docstring mentions Unix's UNIQ(1) command, which operates on strings; so it was surprising for me to find out that `Enum.uniq` doesn't detect duplicate strings unless they are actually the very same object.

What are the possible use cases of such a function? I couldn't come up with anything meaningful.

A patch is provided, just in case.