[Haskell-cafe] whine and solution about programmers not respecting documentations

Ketil Malde ketil at malde.org
Tue Jun 29 01:37:13 EDT 2010


Albert Y.C.Lai <trebla at 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.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants


More information about the Haskell-Cafe mailing list