Generalise type of deleteBy
wren romano
wren at community.haskell.org
Sun Oct 2 02:15:45 UTC 2016
On Sun, Sep 11, 2016 at 5:11 PM, Joachim Breitner
<mail at joachim-breitner.de> wrote:
> Hi,
>
> Am Sonntag, den 11.09.2016, 11:25 +0100 schrieb Matthew Pickering:
>> deleteBy :: (a -> b -> Bool) -> a -> [b] -> [b]
>
> -1 from me. This makes this different from the usual fooBy pattern, and
> the fact this this is possible points to some code smell, namely the
> lack of a
>
> (a -> Bool) -> [a] -> [a]
>
> function.
I agree. I'd much rather see the (a->Bool)->[a]->[a] function as the
proper generalization of delete.
As far as bikeshedding goes, something like "deleteFirst" would make
it clearer how it differs from filter as well as avoiding issues with
the fooBy naming convention (though I see there's a deleteFirstsBy
which probably ruins our chances of using this name).
--
Live well,
~wren
More information about the Libraries
mailing list