bracketOnError, while, forever

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Thu Feb 10 12:56:09 EST 2005


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

Regards,
    Malcolm


More information about the Libraries mailing list