concept partial application in category haskell

appears as: partial application
Get Programming with Haskell

This is an excerpt from Manning's book Get Programming with Haskell.

  • Simplify this process with partial application
  • In this lesson, you’ll learn the final key element of functional programming: closures. Closures are the logical consequence of having lambda functions and first-class functions. By combining these lambda functions and first-class functions to create closures, you can dynamically create functions. This turns out to be an incredibly powerful abstraction, though the one that takes the most getting used to. Haskell makes closures much easier to work with by allowing for partial application. By the end of the lesson, you’ll see how partial application makes otherwise confusing closures much easier to work with.

    Figure 5.5. Visualizing partial application

    Partial application is also the reason we created the rule that arguments should be ordered from most to least general. When you use partial application, the arguments are applied first to last. You violated this rule when you defined your addressLetter function in lesson 4 (listing 4.6):

    Listing 28.5. Using Functor’s <$> operator for partial application in a context
    maybeInc = (+) <$> Just 1