In Haskell there are two concepts that doesn't look like they are the same, but I don't understand the difference. They are "point-free style" and "partially applied functions".
For point-free styles I'm going to get this example:
instead of: sum xs = foldr (+) 0 xs
we can use: sum = foldr (+) 0
Because xs
is on both sides we can omit it.
And for partially applied functions, I'm going to get this example:
increment = add 1
which could be increment n = add 1 n
, because at the moment of calling it, you need to do it with the argument, just as the first example.
So, what's the real difference between them?
But, for me, in the end it's the same.
Pointfree style - a style of function implementation
Partially applied function - it is a technique of creating new functions
Point-free uses partially applied functions but there are other techniques and combinators https://wiki.haskell.org/Pointfree
Another common Pointfree technique is function composition
plus2 = increment . increment