
This cannot be done efficiently. I'd extend the equivalence relation to a total order and then use sort and group. -1 to adding to the standard libraries. How about publishing this as a (well discoverable) package on hackage and see how popular it gets? On 2020-08-20 19:59, Ignat Insarov wrote:
Hello.
There has been [a question on Stack Overflow][1] asking for a way to group a list by an equivalence relation. Several answers were proposed over time, and I too [have offered a variant][2]. [I also wrote a benchmark.][3]
I propose that the function be added to the standard libraries.
[1]: https://stackoverflow.com/q/8262179 [2]: https://stackoverflow.com/a/57761458 [3]: https://github.com/kindaro/classify-benchmark.git _______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries