[Haskell-cafe] deleteBy type too restrictive

Dan Rosén danr at student.chalmers.se
Thu Jan 14 08:49:16 EST 2010


I realized today that the type for deleteBy in Data.List is too restrictive.
The code is:

deleteBy                :: (a -> a -> Bool) -> a -> [a] -> [a]
deleteBy _  _ []        = []
deleteBy eq x (y:ys)    = if x `eq` y then ys else y : deleteBy eq x ys

though the type deleteBy :: (b -> a -> Bool) -> b -> [a] -> [a] will do good
as well.

Is there a particular reason that the type has this restriction? Otherwise,
where can I post a suggestion to have it untightened?

Best regards,
Dan Rosén

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100114/f71dc470/attachment.html

More information about the Haskell-Cafe mailing list