Haskell 98 Report
Zhanyong Wan
zhanyong.wan@yale.edu
Wed, 30 May 2001 13:41:49 -0400
Hello Simon,
Looking at the definition for deleteBy:
deleteBy :: (x -> a -> Bool) -> x -> [a] -> [a]
deleteBy eq x [] = []
deleteBy eq x (y:ys) = if x `eq` y then ys else
y : deleteBy eq x ys
I can't help wondering why it isn't
deleteBy' :: (a -> Bool) -> [a] -> [a]
deleteBy' f [] = []
deleteBy' f (y:ys) = if f y then ys else
y : deleteBy' f ys
The point is that in the definition of deleteBy, all references to eq
and x are in the form (eq x), and hence the two parameters can be
combined. Is there a reason that the current design was favored when
Prelude was designed? Thanks.
- Zhanyong
--
# Zhanyong Wan http://pantheon.yale.edu/~zw23/ ____
# Yale University, Dept of Computer Science /\___\
# P.O.Box 208285, New Haven, CT 06520-8285 ||___|