O'Reilly logo

Functional Programming in C#: How to write better C# code by Enrico Buonanno

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4. Patterns in functional programming

This chapter covers

  • The core functions Map, Bind, Where, and ForEach
  • Introducing functors and monads
  • Working at different levels of abstraction

A pattern is a solution that can be applied to solve a variety of problems. The patterns we’ll discuss in this chapter are simply functions; functions that are so ubiquitous when coding functionally that they can be seen as the core functions of FP.

You’re probably familiar with some of these functions, like Where and Select, having used them with IEnumerable. But you’ll see that the same operations can be applied to other structures, hence establishing a pattern. I’ll illustrate this with Option in this chapter; other structures will follow in coming ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required