[Haskell-cafe] groupBy without Ord?
jwlato at gmail.com
Sun Mar 23 23:34:42 UTC 2014
I would keep in mind that, given the constraints
- you want to group together all equal elements from the entire list
- the only operation you can perform on elements is comparison for equality
your function will have quadratic complexity (at least I can't see any way
around it). If there's any way of sorting the elements, even if the order
is entirely arbitrary, you should consider it.
On Sat, Mar 22, 2014 at 9:51 AM, martin <martin.drautzburg at web.de> wrote:
> Hello all,
> when I groupBy a list in order to cluster elements which satisfy some sort
> of equality, I usually have to sort the list
> first, which requires Ord. However groupBy itself does not require Ord,
> but just Eq.
> How can I groupBy a List whose elements are only instances of Eq but not
> of Ord?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe