Chapter 8. Working effectively with multi-argument functions

 

This chapter covers

  • Using multi-argument functions with elevated types
  • Using LINQ syntax with any monadic type
  • The fundamentals of property-based testing

The main goal of this chapter is to teach you to use multi-argument functions in the world of effectful types, so the “effectively” in the title is also a pun! Remember, effectful types are types such as Option (which adds the effect of optionality), Exceptional (exception handling), IEnumerable (aggregation), and others. In part 3, you’ll see several more effects related to state, laziness, and asynchrony.

As you code more functionally, you’ll come to rely heavily on these effects. You probably already use IEnumerable a lot. If you embrace the fact that types like Option and some variation of Either add robustness to your programs, you’ll soon be dealing in elevated types in much of your code.

Although you’ve seen the power of core functions like Map and Bind, there’s an important technique you haven’t seen yet: how to integrate multi-argument functions in your workflows, given that Map and Bind both take unary functions.

8.1. Function application in the elevated world

 
 
 

8.2. Functors, applicatives, monads

 
 
 

8.3. The monad laws

 
 

8.4. Improving readability by using LINQ with any monad

 
 
 

8.5. When to use Bind vs. Apply

 
 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage