TIL:
Link: https://github.com/thoughtbot/til/blob/main/haskell/sectioning.md
📌 Sectioning
You can partially apply an infix function by wrapping one argument and the
function name in parentheses. When the returned function is called with an
argument, Haskell will apply that argument to whichever side was left blank.
This is known as . Sectioning is often used when converting to
-- Infix function +
f x = 3 + x
-- Point-free style
-- Haskell will apply the argument to the right side of +
f = (3+)
-- Point-free style
-- Haskell will apply the argument to the left side of +
-- Since addition is commutative, this is equivalent to the definition above
f = (+3)
🔗sectioning
🔗point-free style
Link: https://github.com/thoughtbot/til/blob/main/haskell/sectioning.md
📌 Sectioning
You can partially apply an infix function by wrapping one argument and the
function name in parentheses. When the returned function is called with an
argument, Haskell will apply that argument to whichever side was left blank.
This is known as . Sectioning is often used when converting to
-- Infix function +
f x = 3 + x
-- Point-free style
-- Haskell will apply the argument to the right side of +
f = (3+)
-- Point-free style
-- Haskell will apply the argument to the left side of +
-- Since addition is commutative, this is equivalent to the definition above
f = (+3)
🔗sectioning
🔗point-free style