I am trying to understand how to convert functions to point-free notation in Haskell. I saw this example, but it is more complicated than what I am looking for. I feel like I un
The "pointfree" program can be installed with cabal install pointfree
, and shows you how to write an expression in pointfree style. For example:
$ pointfree "f x = 5 + 8/x"
f = (5 +) . (8 /)
Explanation of this conversion:
(a +) == \b -> a + b
and (+ a) == \b -> b + a
.
function takes the result of the second parameter, which is a one-argument function, and applies it to the first argument.