The on combinator (in Data.Function , as indicated by gspr in another answer) is defined
g `on` f = \xy -> g (fx) (fy)
What would you write
h = g `on` f
You can make generalizations of this, for example
g `on3` f = \xyz -> g (fx) (fy) (fz) g `on4` f = \wxyz -> g (fw) (fx) (fy) (fz)
So you can write
h = g `on3` f
There may be a way to write on3 and on4 in terms of on , but if there is, I cannot see it at the moment.
source share