bracketOnError, while, forever

Remi Turk rturk at science.uva.nl
Wed Feb 9 19:32:12 EST 2005


On Wed, Feb 09, 2005 at 08:47:43PM +0100, Tomasz Zielonka wrote:
> On Wed, Feb 09, 2005 at 11:50:48AM -0000, Simon Marlow wrote:
> > 
> >  sortBy (comparing fst)
> > 
> > is just too cute not to have.  Any objections?
> 
> How about a more general function:
> 
>     composeFGxGy :: (b -> b -> c) -> (a -> b) -> a -> a -> c
>     composeFGxGy f g x y = f (g x) (g y)

I agree, though I don't like its name ;) Mike just called it
`onField', and I've seen it as `on' before.

	sortBy (compare `on` fst)
	groupBy ((==) `on` toLower)
	zipWith ((*) `on` fst)

Having both `comparing' and `equaling' seems overkill, and just
`on' is just as usable IMO. (No, I never used that last one.)

Greetings,
Remi

-- 
Nobody can be exactly like me. Even I have trouble doing it.


More information about the Libraries mailing list