bracketOnError, while, forever

Ross Paterson ross at soi.city.ac.uk
Thu Feb 10 13:05:32 EST 2005


On Thu, Feb 10, 2005 at 05:56:09PM +0000, Malcolm Wallace wrote:
> Here's another common function I use all the time, which appears to
> be missing from Data.List:
> 
>     elemBy        :: (a -> a -> Bool) -> a -> [a] -> Bool
>     elemBy eq _ []          =  False
>     elemBy eq x (y:ys)      =  x `eq` y || elemBy eq x ys

Section 17.6 of the Report:
"The library does not provide elemBy, because any (eq x) does the same
job as elemBy eq x would."


More information about the Libraries mailing list