Haskell 98 Report

Simon Peyton-Jones simonpj@microsoft.com
Thu, 31 May 2001 00:43:13 -0700


I don't think there was a deep reason, but
the current story makes it more like the other 'By' functions.
Anyway, this is one thing that is not going to change!
(Not that you were proposing that it should.)

Simon

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