Advanced Functional Programming with Elixir (PragProg)

Joseph Koski

Series editor: Sophie DeBenedetto @SophieDeBenedetto
Developmental editor Adaobi Obi Tulton @aotulton

Combine advanced functional programming concepts with production-ready Elixir and proven domain-driven design techniques to write cleaner, more thoughtful software. You’ll explore foundational ideas like equality, ordering, predicates, monoids, and monads—then go beyond syntax as you develop intuition for composing logic, modeling behavior, and growing systems. With a focus on maintainable, declarative code over theory, you’ll gain practical, composable patterns you can apply right away.

Get ready to manage crowds, adjust priorities, and keep everyone safe in FunPark, a place that never sits still. Your job is to model that complexity and build the systems that keep everything running smoothly, even as the business team is still figuring out what they want and the experts keep rewriting the rules.

Using core abstractions—equality, ordering, predicates, monoids, and monads—you’ll break problems into small, composable pieces that are both well-behaved and easy to combine. Rather than getting bogged down in theory or formal proofs, you’ll dive into real-world Elixir—using protocols, structs, and pattern matching to express shared behavior across your domain. Along the way, you’ll build the vocabulary and mental models you need to organize complex logic, supported by a production-ready open-source library you can use, extend, and explore in your own projects.

Whether you’re an Elixir developer mastering functional programming or a functional programmer exploring Elixir, you’ll discover how to write code that’s easier to reason about—and create systems that stay understandable, even as they grow.


Joseph Koski is a software engineer with expertise in functional programming, domain-driven design, and safety-critical systems. He created the Funx library, bringing tools like monads to Elixir. He writes at www.joekoski.com, sharing insights on functional programming, real-time systems, and using Elixir to solve complex, reliability-focused problems.


Don’t forget you can get 35% off with your Devtalk discount! Just use the coupon code “devtalk.com" at checkout :+1:

31 Likes

Alright, another one to add to the library!

P.S. Need to add “www” in the link to the author’s personal site.

4 Likes

Perfect timing! Just finished Ulisses Almeida “Learn Functional Programming with Elixir” and this new book by Joseph Koski feels like the natural next step.

3 Likes

Thanks for pointing out the fix needed to the URL. We’ve updated it.

3 Likes

Amazing! Thank you so much! Looking forward to this!

4 Likes

Looks like a great entry to the PP Elixir lineup. I look forward to lighting up a pipe or cigar and taking it in.

4 Likes

I really hope our community embraces functional programming idioms. Whenever I see a globally named process being used as a singleton in OOP gives me goosebumps.

3 Likes

I really like the cover, im sold on the book :sweat_smile:

3 Likes

Yeah, we often treat functional programming as all or nothing, but really it is just a set of patterns and abstractions. You can start with a couple of simple ones and stop there. And there is no need to rewrite the codebase. It is easy to cut into a functional abstraction when it helps, then cut back to idiomatic Elixir.

Also, I would not claim that every codebase should use functional programming. However, I would suggest that knowing patterns makes for better developers.

2 Likes

On a scale of 1-10 , would you recommend this book for someone who considers themself a “working man programmer” and not really reading for the theory or intellectual stimulation.

Ive tried reading functional programming books b4 and I have gotten some gems out of them, my fav is building functions that follow 3 steps.

  1. the fn should only return a single thing
  2. a fn calculates its return based on its arguments values
  3. the function cannot mutate existing values

Those rules has helped me to build things cleanly like lego, but I will admit I rarely think of fp and elixir isnt as strict as something like haskell when it comes to fp, you can pretty much hack your way around thanks to the actor model and also otp laying alot of ground work so you cant really mess up. Sure with fp writing declarative code is a dream, things being immutable by default is also great. but what is the bigger picture of getting more in tune with fp for elixir? I rarely hear the elixir comm focusing on FP culture

I am a bit turned off by the fact we are using an external library to learn said concepts, does that mean using elixir primitive’s to build up such machinery in a normal setting, is ehh ceremonial and not done often? I am most likely going to buy it cause I like the cover & its 30 bucks, but can you give me like a cool example that would wow me away and also tie it with the actor model

I appreciate how much you put into your comment. You raise solid points that deserve a proper reply.

Once upon a time, I taught music at a university. We had evidence, which was eventually published in Peak, that mastery requires three basic parts. One, we need to work just beyond our current skill level. Two, we need continuous and consistent feedback. Finally, we need someone to light the path, someone to show us the quickest way forward.

I would make the argument that while FP patterns are not appropriate for every codebase, knowing them is helpful. Sort of like having a student work hard to master patterns in all keys. It is really hard to perform in odd keys when those patterns are not under your fingers. The same is true in Elixir. You may not reach for these abstractions every day, but when you encounter logic that involves optional values, layered validations, or context-aware computations, it helps if the patterns are already familiar.

In the world of Google, Wikipedia, and now LLMs, a book needs to earn its keep and its price tag. Mine included. It is easier than ever to find information on functional programming, but it is still hard to sort out the learning path. My book’s value proposition is that it saves time. It shows what to practice, in what order, and why it matters. It helps focus attention, avoid common missteps, and move forward with purpose.

I like that you asked for a wiz bang finish. I will give it my best shot. My goal has been to remove barriers to learning functional programming, which takes more than just writing a book. I have been building a larger ecosystem that I have been slowly releasing to friends. If you have access to a more powerful LLM, such as Claude Code, you can ask me your questions directly through this project: AI Tutor for Functional Programming - Funx . I would love to hear what you think if you give it a try.

4 Likes

That looks incredibly cool! My primary usage for LLM is as a learning assistant, and this looks like the perfect tool to play around with Funx.

2 Likes

On a scale of 1-10 , would you recommend this book for someone who considers themself a “working man programmer” and not really reading for the theory or intellectual stimulation.

To answer your question directly, I would personally say “no”, but I still think the book is worth a read. (If you have to manage applications with a lot of complicated rules and are looking for a way to wrangle the complexity, I would probably say “yes”, the book may be directly useful to you.)

For me, this book was definitely very intellectually stimulating, and I feel like the techniques involved would be very useful in managing the organization of ever-increasing complexity. For example the book uses amusement park ride management as an example, but the same situation can happen with many legacy applications as the rules (and exceptions to those rules) grow like a cancerous tumor.

If the concepts in the book are applied properly, I do believe that they could be used to compose the logic required to manage some pretty complicated scenarios. Of course, I haven’t yet had the opportunity to do this, but I look forward to using this tool if I find a need for it in the future.

This book is pretty much a guided tour of the Funx library. It gives you the logical bits and pieces from that library, and shows how the different parts come together from the ground up, and how they work with each other.

I don’t know if it is essential to read the book before using the library, but I will say this: Before I read the book, I had no idea what any of the stuff in the Table of Contents meant, but after I read the book, it made perfect sense. I think that it would be a big undertaking to understand what’s happening in Funx without reading the book beforehand, unless you’re familiar with Haskell. (I believe that Haskell is the source of a lot of the concepts used in the book.)

4 Likes

Funx provides a lot of context for LLMs, which in theory means they can leverage that context to teach you how to use Funx. The project I shared above is a natural outgrowth of its usage rules. But LLMs tend to wander, so the book paints the most direct path.

1 Like

I’d love to hear your experience.

My initial hurdle would be that I don’t use Claude Code, and prefer to run local LLMs. I’ll see how much progress I can make, and report back if I can get anything going that way.

1 Like

Interesting, I run Ollama on my home server as well. I figured it would struggle with assembling and managing all that context so I have yet to see what it might come up with.

1 Like

I just bought the book. I will start reading it over the weekend.

5 Likes

Kudos for the author. Great work

1 Like