Proposal: add 'equating' function to Data.List

Henning Thielemann schlepptop at henning-thielemann.de
Fri Jul 18 19:31:02 UTC 2014


Am 18.07.2014 21:26, schrieb Frerich Raabe:

> In a similiar vein as with 'comparing', I think it would be nice if
> there was a function which encapsulates this use case, like
>
>    equating :: Eq b => (a -> b) -> a -> a -> Bool
>    equating = on (==)
>
> such that one can write
>
>    groupBy (equating snd)

I think it belongs to Data.Eq.

I have already added it to my own Data.Eq module:
 
http://hackage.haskell.org/package/utility-ht-0.0.10/docs/Data-Eq-HT.html

this way I do not need to depend on a new GHC version in order to use it.



More information about the Libraries mailing list