Proposal: add 'equating' function to Data.List

Frerich Raabe raabe at froglogic.com
Sun Jul 20 10:51:41 UTC 2014


On 2014-07-18 21:26, Frerich Raabe wrote:
> 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 don't know whether this is relevant to the decision making process, but it 
appears there's some precedence already in the 'basic-prelude' package by Dan 
Burton and Michael Snoyman: the 'CorePrelude' module exposes an 'equating' 
function:

   
https://hackage.haskell.org/package/basic-prelude-0.3.8/docs/CorePrelude.html#v:equating

- Frerich



More information about the Libraries mailing list