I answered a question on Stack Overflow that I thought might be worth sharing here so that others might get an idea of how to refactor code into point-free style.
I wrote a function that inserts or updates a Map key value depending on whether the key is already in the map. If it is, then the value gets added to the already existing map’s value.
Notice the use of Map.insert
Notice that you are mapping (+) over the possibility of having or not having a value
Notice that Data.Map has a function for applying functions to values, called Data.Map.insertWith. It’s extremely common for collections to have a helper function for “insert data with a helper function / default value”
Notice the shared structure of the types of your function and insertWith
Realize that applying (+) to insertWith will make the types identical
Validate assumptions with specific examples, more rigor is available with the use of QuickCheck.
This is a practically golden opportunity to demonstrate how eta reduction can simplify code and kill off redundant logic.