>
> I noticed that the *By functions (deleteBy, deleteFirstsBy, elemBy,
> etc.) in the current on-line HTML library documentation have type signatures
> which restrict the types beyond that required by the implementation.
> For instance:
>
> elemBy, notElemBy :: (a -> a -> Bool) -> a -> [a] -> Bool
> elemBy eq _ [] = False
> elemBy eq x (y:ys) = x `eq` y || elemBy eq x ys
>
> My recollection is that when I brought this up last on this mailing
> list, public input ran in favor of not restricting the type signature.
> (For instance
> elemBy, notElemBy :: (a -> b -> Bool) -> a -> [b] -> Bool
> )
>
I'm probably missing the point of the (elemBy, notElemBy) pair
alltogether, but why not just stick with `any'? i.e., of the
two value bindings
ls :: [HaskellImplementation]
wibble = elemBy (inTheBallpark) 1.3 ls
frob = any (inTheBallpark 1.3) ls
`frob' is clearer than `wibble' - YMMV.
What is the motivation for including {not}elemBy in List? If it is
the wish to have 1-1 match of *By functions with PreludeList defns
that uses type class predicates (from Eq and Ord) then elemBy should
stay as is, and any uses of `non-standard' equality predicates (e.g.,
a -> b -> Bool) are better coded up using `any', `filter' etc.,
since the generalised predicate is not applicable to all *By functions
(cf. deleteFirstsBy, nubBy).
All IMHO, of course.