
On Tuesday 29 June 2010 10:47:40, Zura_ wrote:
Maybe it is because deleteBy is defined wrongly? i.e. it is not logical, doesn't follow the common sense user might expect. It accepts any predicate but narrows requirements only in docs.
Unfortunately, you can't easily encode the requirement that it ought to be an equivalence relation via types. So putting it in the docs and hoping nobody gets burned too badly is probably the best one can do.
Maybe best could be to just take a value for comparison and use "==" against it?
That's the plain delete.
("overloaded" or "built-in" (I'm a C++ engineer but as I know it is possible in Haskell as well.))
And to have separate delete which accepts arbitrary predicate. (As it is now.)
Regards, Zura
Albert Y. C. Lai wrote:
The doc of deleteBy states: "The deleteBy function behaves like delete, but takes a user-supplied equality predicate." A precondition is that the user-supplied predicate is an equality predicate. (>=) is not an equality predicate, be it in the layperson sense of "it isn't analogous to (==)" or the mathematical sense of "it isn't an equivalence relation".