On 29.06.10 08:37, Ketil Malde wrote:
Albert Y.C.Lai<tre...@vex.net>  writes:
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".

One could argue that this is a bad specification.  The type is

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

but there are further limitations on the arguments, and worse, the function
doesn't check this and produce an error if the arguments don't conform,
but just silently produces a meaningless result.
How can 'deleteBy' check that an argument is an equivalence relation? (Putting aside that this harms performance.)

--
Best regards,
  Roman Beslik.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to