Proposal to generalize the type of List's deleteBy function

Grant Slatton grantslatton at gmail.com
Sun Jun 21 06:32:08 UTC 2015


Right now the type of deleteBy is:

(a -> a -> Bool) -> a -> [a] -> [a]

That is, it takes an equality predicate, a value, and a list, and deletes
the first element in the list such that the equality predicate returns true
for the given value and the element.

This can be generalized to:

(a -> b -> Bool) -> a -> [b] -> [b]


Example use case:

keyValues :: [(a, b)]

key :: a

deleteBy (\x (y, _) -> x == y) key keyValues



Thanks

Grant Slatton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20150620/a3fd7260/attachment.html>


More information about the Libraries mailing list