Is there a shorter way to express this haskell idiom? Every so often I have a function of type a -&gt; b and a function of type b -&gt; b -&gt; c and I would like a function of type a -&gt; a -&gt; c.  For example if I wanted to check the second element of each two tuples were equal

snd :: (a , b) -&gt; b
(==) :: Eq a =&gt; a -&gt; a -&gt; Bool


And I want something of type

Eq b =&gt; (a, b) -&gt; (c, b) -&gt; Bool


The best way I have found to do this so far is

f g z=(.g).z.g


Which is ok, but it feels unneccessarily complex for something that is this simple.
The pointfree representation is even worse:

flip=&lt;&lt;((.).).(.).flip(.)


Additionally it feels like this idiom should be representable with some sort of abstraction (it feels a lot like (&lt;*&gt;)).  I attempted to find a replacement by abstracting our functions to functors, the result is not very enlightening

flip=&lt;&lt;(fmap.).fmap.flip fmap ::
  Functor f =&gt; f a -&gt; (a -&gt; a -&gt; b) -&gt; f (f b)


Is there a shorter way to express this idea?  Particularly the pointfree version?
I think eta-reduction is severely overrated. I see a lot more attempts at eta-reduction in the wild than I think is reasonable.

So it is in this case: eta-reducing this function is not helpful, I think. It's much more readable and elegant in its full form:

f :: (a -&gt; a -&gt; c) -&gt; (a -&gt; b) -&gt; b -&gt; b -&gt; c
f g h a b = g (h a) (h b)




On a related note, such function exists in the standard libraries. It's called on, and the idea is to use it in infix form, so that it almost reads like English:

eqAmounts = (==) `on` amount
cmpNames = compare `on` name