r/functionalprogramming • • Aug 24 '26 Bravo

FP "A monad is a monoid in the category of endofunctors" But what does that actually mean?

Thumbnail
youtube.com
59 Upvotes

This video uses Haskell as an interactive proof assistant to break down every single word of the most famous definition in functional programming. It translates abstract category theory concepts—categories, endofunctors, monoids, and natural transformations—directly into typed Haskell code.


r/functionalprogramming • • Jul 13 '22

FP Functional programming is finally going mainstream

Thumbnail
github.com
59 Upvotes

r/functionalprogramming • • Nov 08 '21

Question Gang of four "Design Patterns" equivalent in functional programming

59 Upvotes

In OOP the design patterns defined in "Design Patterns" by the gang of four is kind of an industry standard, right?

I know the concept of design patterns probably does not translate 1:1 to FP, but my question is: Does FP also have some kind of agreed upon best practices / industry standards collection?

Apologies if this is a duplicate question and thanks in advance for your insights.


r/functionalprogramming • • Oct 05 '24

Gleam Gleam is Pragmatic

Thumbnail blog.drewolson.org
58 Upvotes

r/functionalprogramming • • Aug 07 '24

Question What about Ocaml

58 Upvotes

I'm interesting about Ocaml and I have few questions

  1. It's a good FP for beginner, but bad chose for commercial use?

  2. Who use and for what?

  3. What about community?

My research shows it more academic language for soul. On GitHub, Ocaml has ~17k repo in public. Job market is pure (I found 22 position on https://ocaml.org/jobs)


r/functionalprogramming • • Jan 27 '23

FP On Not Drinking the FP Kool-Aid

58 Upvotes

FP proponents are missing the point in most of the articles they write about more advanced topics, usually about computational wrappers like functors, applicatives and monads. They usually start from the basics and build up the complexity gradually. Nothing wrong with that.

The problem is they rarely (ahem, almost never) write the follow up post which shows how they applied these advanced topics in real world programs in ways that were superior to the non-FP alternatives every developer already thinks to do. Their examples are contrived and fail to offer a compelling "why bother?" They fail to show, pragmatically, how their approach is superior when compared to the other.

The articles are mostly the same. The person clearly understands the theory. They adequately demonstrate that, and then they stop.

The reader, presumably a dev, scratches his head, thinks "so what", and goes back to his day job ignoring everything he just read. When he thinks about the programs he's currently writing he sees no reason to add these monadic whatevers. To him, it sounds like a lot of ceremony for very little return on the investment. He's like, ummm, yeah, but why would I do that? You want me to learn intellectual gymnastics just so I can do a few backflips on my way to my car!? No thanks!

From his perspective the writer wrapped a bunch of vars just so he could lasso the neck of the purity unicorn. He can't see how his programs are justifiably better for the extra purity. He can't see how the new way improves how he'll get things done compared to what he's already doing. He sees the new way as adding a layer that requires him to leap through a bunch of weird interfaces. He can't see why he should pay the cost. He keeps to the easy, ordinary way.

The issue is the writers never actually get to the part where they ask, can't you see how in this program, when this new requirement was levied on our team, all of that ceremony paid off? Can't you see how my program is actually easier and cheaper to enhance and maintain (than your program) because of the whatevers?

Remember the build-a-blog-in-15-minutes video that sparked the Rails craze? It was accompanied by a book. It showed you how to build a blog in a way which seemed pleasant and easy compared to the status quo. It sold the Kool-Aid. It got people thinking this actually is easier than what I know. People traded in the status quo for a ride on the shiny new set of wheels. The book built up a real world program everyone could relate to.

Likewise, Hickey modeled an understanding of time and showed folks how immutability and purity could be used to great gain. He sold the value of separating the pure part of a program from the impure, imperative part. And that made program maintenance far easier than what I once knew. So I drank that Kool-Aid, every last drop.

I didn't find Clojure terribly hard to grok. But I feel like I've only half ascended the FP ladder. When I look up I see those who have so embraced purity that if they could wrap their house in a monad just so they could walk purely through the front door, they would.

I use monads and functors here and there, but not all of them. And often I only use them to accommodate one particular functional composition. I'm supposing the purists have their entire programs wrapped in monads where I only use them briefly as needed. Most of my program's values are unwrapped. The only thing I routinely wrap (in a ClojureScript atom) is the world state.

You see, in my opinion, all theory gives way to time, money and energy. Every pattern, every language, every paradigm, serves us only in one respect. Does it save me (or my team) these costs over the life of the program?

So when someone talks about wrapping things to lift their program into a state of purity nirvana, they have to justify adding the layer. Does that layer of whatevers add to or subtract from the cost of the program over its life? Or did it take the next guy longer to mentally unravel and fix, when it came time to add a feature? You see, at some point and at some level, no one actually cares what your favorite language is, what's the best web framework, etc. They just want to know what you can deliver and the cost of getting it. The world is pragmatic that way.

I'm enthusiastic about what Clojure taught me. It's just that Clojure only gets you half through the FP forest and I've yet to come out the other end. I sometimes struggle to answer why I should take things further, even after reading countless articles about whatevers.

I don't feel the FP enthusiasts further up the ladder are doing a great job selling the why. The articles are contrived, theoretical, impractical. They're not offering real world anecdotes that show how their approach helps reduce real world costs building real world solutions, compared to the other way. They're not compelling anyone to drink the Kool-Aid. We need more talks, articles, books which cast vision and justify the costs of the added ceremony, theory be damned, the way Hickey did, but for the upper half of the ladder.


r/functionalprogramming • • Jun 15 '25

Question What’s your favourite way to explain a monad to a beginner?

57 Upvotes

What’s your approach?


r/functionalprogramming • • Mar 23 '20

JavaScript An introduction to Lambda Calculus, explained through JavaScript

Thumbnail
willtaylor.blog
57 Upvotes

r/functionalprogramming • • May 10 '26

Question Do you feel limited by coding in a less typed FP language compared with something like Haskell/Scala/Ocaml?

56 Upvotes

I really can't code in Go anymore. I love the simplicity, but I can't code without option/result, enums, ADT, ... But getting something better than Go, on this area, creates a hard decision to make in terms of how far should the type system goes. For example, Gleam is FP and typed, but the type system, of course is better than Go's, but it's no where near something like Haskell/Scala. Since I did not worked with Haskell before, and did just basic things on Scala, does it really matters?

On my current view, the biggest improvements in correctness come from using ADT, immutability, and errors as values. But there is also typeclasses, phantom types, linear types, GADT, .... to what degree where talking about syntax sugar or actual modeling features. I think I could live without all the syntax sugar, and write a little more code, or even some boilerplate, given the years coding in Go, but I would like to correctly express the constraints at the code.

I hope this question is understandable.


r/functionalprogramming • • Jul 08 '25

Question why not Lisp/Haskell used for MachineLearning/AI

56 Upvotes

i have a course on topic of AI: Search Methods and it the instructor told about Lisp, found out it was a func-lang, also told about functions like car & cdr why in the real world of AI/ML func-langs aren't adopted more when they naturally transfom to operations like, map->filter->reduce->functions

am I missing something ?


r/functionalprogramming • • Feb 15 '24

Question Scripting language like Python, bur with the feeling if Rust

56 Upvotes

Rust is a great language, but sometimes I wish to have something more like Python, but with a more "Rusty" feeling.

With "Rusty" feeling I mean project management with cargo, Error Handling with Result/Option, pattern matching, strong static typing with type inference, immutability by default and so on.

This means, I'm searching for a functional programming language. My problem is, that all functional languages I found until now compile to something intermediate like Beam, JVM, .NET, JS or build binaries like Haskell.

What I'm looking for is a scripting language like Python. Just an interpreter, that runs a script, but with the "if it compiles, it runs" experience of Rust. And yes, I know that compile time type checking and script interpreter are different kind of shoes, but who knows...

Any idea?


Thanks for all the comments. A lot of good suggestions, but I decided to go with F#. I think it comes closest to Python. It runs on Linux and Windows, can run in a Jupyter like notebook and has a nice syntax. I have some (rudimentary) experience and the book "domain driven design made functional" from Scott Wlaschin, which I really like. It is well documented and you can find lots of books, tutorials and videos. Languages like Mojo lack documentation.

It is not as "Rusty" as I would like, but close enough. So if someone is searching for an alternative to Python, try F#


r/functionalprogramming • • Aug 01 '21

Conferences Domain Modeling Made Functional - Scott Wlaschin - KanDDDinsky 2019

Thumbnail
youtube.com
56 Upvotes

r/functionalprogramming • • Jan 13 '21

Question Why do you think Data Scientists prefer Python to typed functional languages?

56 Upvotes

Seems like Python is the preferred language for Data Scientists. In my mind Types is very relevant to Data. Functional programming is relevant to processes data accurate and fast.

So why are Data Scientists not adopting Typed Functional Languages to a higher extent?


r/functionalprogramming • • Oct 24 '24

Question Popularity of different functional languages

55 Upvotes

At this point, we have a lot of functional languages; some nearly identical, and some extremely different. But the popularity of various languages doesn’t necessarily seem to follow a consistent pattern. I know GitHub stars don’t mean everything, but it has me wondering if there are downsides that aren’t obvious.

Ocaml - don’t hear much complaints, and companies like Janestreet show its viability while also creating popular libraries for it. Seems like it can build cross platform apps/mobile, full stack web dev, etc. Not many videos or tutorials, however, and about 4.5k stars on the hub.

F# - “ocaml dotnet”, has cool features like units of measure. It can also build cross platform apps/mobile, full stack web, etc. Allows imperative programming, OO, can still use for loops. Some videos and tutorials but really just piggybacking off dotnet libraries (which should be a good thing imo). 3.9k stars

Scala - doesn’t seem to be as multi platform or full stack as the last two, but supposedly “has the best job market”. I’ve also heard it gets used in data science occasionally. Syntax looks weird to me but maybe it grows on people? 5.9k stars for scala3 and 14k for the general scala repo.

Elixir - seems mostly web focused, but looks like full stack is quite good. Seems like mobile is shaping up as well. Nx as the “standard” math library is appealing. But at the moment is still dynamically typed. 24k stars

Gleam - static elixir, but lacking “normal” imperative features that are nice to have every now and then. 17.8k stars

What does gleam and elixir have that F# and Ocaml don’t? Why do people say Scala and F# are the best for “real world” use cases? F# does seem like a solid jack of all trades while being much, much faster than the current king in that area (python).

I personally don’t care at all about the job market, so maybe that’s the one thing I’m overlooking. My personal goal is to make more videos on how to use functional programming for math/science, but I want a language that I can do everything in (a tall task, but if python can do it while running at a snail’s pace, certainly others can come close). F# fit the bill for me, but I don’t see it becoming widely adopted whereas the other languages appear to have hope despite seeming less polished.

I’d love to hear your thoughts on why some langs see success. Is it all Microsoft’s fault? Is elixir just that good? I don’t care about dotnet or jvm, but does that make a difference besides the package ecosystem?


r/functionalprogramming • • Jul 27 '26

Conferences Alexis King: The Unreasonable Effectiveness of Constructive Data Modeling

Thumbnail
youtu.be
54 Upvotes

Hi folks, this is Alexis' talk from SSW earlier this month. I thought you all would enjoy it!


r/functionalprogramming • • Feb 14 '25

FP Algebraic effects are a functional approach to manage side effects

Thumbnail
crowdhailer.me
54 Upvotes

r/functionalprogramming • • Mar 14 '24

Question What is your review about the Gleam programming language?

Thumbnail
gleam.run
54 Upvotes

Do you plan to use it?


r/functionalprogramming • • Apr 20 '23

Haskell Today: Interview and AMA with Simon Peyton Jones, lead developer of Haskell

54 Upvotes

Later today (April 20th) at 19.30 UTC, I'll be speaking with Simon Peyton Jones, one of the team behind Haskell, on a a YouTube livestream.

Simon is renowned for his work in lazy functional languages, and I'll be exploring his career of building languages, especially Haskell, but also C-- and most recently Verse. We'll dig into his work at both Microsoft Research and Epic Games, and exploring the lessons we can take from a monumental career. At the end we'll put your questions to him in an AMA.

Everyone is welcome to come and join in and ask questions.

The interview is part of Exercism's #12in23 - a year long challenge to encourage people to try 12 new languages throughout the year. So far, I've interviewed José Valim (Elixir), Louis Pilfold (Gleam), Cameron Balahan (Go), Josh Tripplet (Rust), and Bjarne Stroustrup (C++) - they're all available to watch back on YouTube!


r/functionalprogramming • • Apr 11 '22

Question Which functional programming language to learn first?

54 Upvotes

I've been wanting to learn functional programming for a while now. However, since there are so many functional programming languages, I haven't been able to decide on a particular language and am therefore asking for advice. I'm already familiar with imperative and object oriented programming (C, Java, Python, JavaScript), so "friendliness towards new programmers" is not a factor.

The three languages that interest me the most are (in no particular order):

  • Haskell

  • OCaml

  • Clojure

Which one would be the best to learn first? What are the advantages and disadvantages of each? Thanks in advance.

Edit (2022-04-17): Thank you all for your great suggestions! I've decided to stick with Haskell, mainly due to it being well suited for learning purposes (considering that Haskell is purely functional in contrast to other languages). I will probably find this difficult at first, but I think that the payoff of truly familiarizing myself with functional concepts is well worth it.

I'm still planning on learning OCaml and Clojure in the future, but for now, Haskell should be plenty :-)


r/functionalprogramming • • Apr 10 '21

Rust Orion, a purely functionnal Lisp written in Rust.

Thumbnail
github.com
54 Upvotes

r/functionalprogramming • • Dec 01 '19

FP What is Functional Programming? (1st of 24 articles on FP this Christmas)

Thumbnail
functional.christmas
54 Upvotes

r/functionalprogramming • • Jul 24 '19

Intro to FP Functional programming design patterns by Scott Wlaschin

Thumbnail
vimeo.com
54 Upvotes

r/functionalprogramming • • Apr 30 '26

FP Functional Programmers need to take a look at Zig.

Thumbnail pure-systems.org
53 Upvotes

r/functionalprogramming • • Mar 24 '25

FP Most actively developed/maintained FP language

53 Upvotes

I have played with Haskell, tried Scala and Clojure and my best experience was with Haskell.

But I wish to know which language is the most practical or used in production.

Which is actively been worked on, which has a future apart from academic research etc etc.

Thank you for your answers.