Does functional programming have an answer for everything?

Some might say that functional programming has the answers to solve the problems of concurrent, parallel, and distributed systems. But is that true? We explore what FP has to offer.


Eric Normand: Does FP have the answer to everything? Hello, my name is Eric Normand. These are my thoughts on functional programming.

I'm writing this book and part of me wants to have the answer to everything. Part of me wants to say this is how a functional programmer would solve this problem and this is how a functional programmer solves this problem.

For a lot of problems, it's true. We do have answers. We have a lot of tools that are disposed when they do solve problems, I think, definitively. The thing is, though, we don't have all the answers and there are constantly new problems coming up. What I think FP has to offer, more than any particular answers to questions or answers to problems, is that we're asking good questions.

These questions are becoming increasingly relevant in a world, in a multithreaded world, a distributed systems worlds where you got the shared resources that maybe they're shared on a same machine or maybe they're shared among multiple machines, and you need a way to deal with this added complexity.

Functional programming is actually asking the right questions. Functional programming asks what operations do we have that really depend on when they're run or how many times they're run. What can we represent as data because that's the only thing we really know how to transfer from one machine to another?

Transferring code is actually really hard. We can only do it in very limited ways. I can send you some JavaScript because I know you're in a browser and it's a known environment. In general, we're sending data back and forth.

What can be represented as data and how do we interpret that the way we need to at the right time? What is a pure calculation that we could run on this and not worry about all those concerns about when it's run or even what machine it's run on?

These are questions that functional programmers ask. It's the analysis that we do that's what provides value. There are definitely tools that once you've analyzed it, these tools could help. These are functional programming tools.

Also, most of the value comes from the questions, and the analysis itself, just figuring out how do these things fit together in terms of time.

I love it when people comment on this podcast, when they ask me questions, when they disagree with me and we get into a great discussion. It's one of the main reasons I'm doing this. If you want to get in touch with me, just find me on Twitter, @ericnormand. Also, you can email me, I am really looking forward to hearing from you. See you later. Bye.