
On Fri, Jan 16, 2004 at 01:43:40AM -0800, Brandon Michael Moore wrote:
Hello, and welcome me to the list
Welcome 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: e.g. sortFoos :: [Foo] -> [Foo] sortFoos = sortBy (\x y -> compare (f x) (f y))
No need for so many new functions. Just write a function: composeFGxGy :: (b -> b -> c) -> (a -> b) -> a -> a -> c composeFGxGy f g x y = f (g x) (g y) Then you can: sortFoos = sortBy (composeFGxGy compare f)
How does this sound?
And how does _this_ sound? ;) Best regards, Tom -- .signature: Too many levels of symbolic links