Understanding `ap` in a point-free function in Haskell
问题 I am able to understand the basics of point-free functions in Haskell: addOne x = 1 + x As we see x on both sides of the equation, we simplify it: addOne = (+ 1) Incredibly it turns out that functions where the same argument is used twice in different parts can be written point-free! Let me take as a basic example the average function written as: average xs = realToFrac (sum xs) / genericLength xs It may seem impossible to simplify xs , but http://pointfree.io/ comes out with: average = ap ((