Generalise type of deleteBy
Matthew Pickering
matthewtpickering at gmail.com
Mon Sep 12 09:20:23 UTC 2016
Malcolm, the semantics of deleteBy are slightly different as it only
deletes the first occurrence. In the end however I did use `filter` as
I didn't
care particularly about just deleting the first matching value, as
there was at most one matching value in the whole list.
Joachim, it seems to me that `deleteBy` is the odd one out as the
types of `sortBy` and `maximumBy` are the most general types.
Anyway, this function is not used very often. I searched on hackage
and there were less than 50 uses. There is a simple patch which I have
provided and people are welcome to merge if they like but I don't
think we should spend a lot of time arguing about this or worrying
about potential breakage.
Matt
On Mon, Sep 12, 2016 at 9:53 AM, Malcolm Wallace <malcolm.wallace at me.com> wrote:
>
> On 11 Sep 2016, at 17:19, Henning Thielemann wrote:
>
>>
>> I do not see why deleteBy should have an argument for the deleted element, anyway, since it is not even the element to delete (only an equivalent one). Wouldn't a function with type
>>
>> newDeleteBy :: (a -> Bool) -> [a] -> [a]
>>
>> be much more straight-forward?
>
> It already exists, and is called "filter", modulo the sense of the boolean.
>
> Regards,
> Malcolm
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
More information about the Libraries
mailing list