[Haskell-cafe] groupBy without Ord?

Kim-Ee Yeoh ky3 at atamo.com
Sat Mar 22 19:23:25 UTC 2014


On Sun, Mar 23, 2014 at 1:29 AM, martin <martin.drautzburg at web.de> wrote:

> So I often wonder, where you
> would use Haskell's groupBy WITHOUT sorting first, but I assume there are
> situations, where this is useful.
>

But if you sorted first, then there must be an Ord-er on the elements, yes?
In which case you could then apply (sqlGroup = group . sort) as originally
desired.

I'm sure groupBy is useful standalone (dim memories of some functional
pearl) but your hunch is right in that I normally use it after a sorting
step.

-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140323/604f923d/attachment.html>


More information about the Haskell-Cafe mailing list