List functions - "Under" operations

Brandon Michael Moore brandon at
Fri Jan 16 01:43:40 EST 2004

Hello, and welcome me to the list

I think it would often be useful if the list functions with class
constraints had versions paramaterized on a function mapping your element
type into an instance of the classes, in addition to the "By" forms that
take an implementation for the required class method.

Almost all of the times I use the "By" functions follow that pattern:
sortFoos :: [Foo] -> [Foo]
sortFoos = sortBy (\x y -> compare (f x) (f y))

I suggest "Under" as a modifier. "By" would be nice (as in "sortBy fst",
"sortBy valueOf", etc) but it's already taken. We are using the image
under some function to control the list munging, so it seems appropriate.

How does this sound?

Brandon Moore

More information about the Libraries mailing list