frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Why Reliability Demands Functional Programming

https://blog.rastrian.dev/post/why-reliability-demands-functional-programming-adts-safety-and-critical-infrastructure
46•rastrian•2h ago

Comments

mlavrent•1h ago
This article seems to conflate strong type systems with functional programming, except in point 8. It makes sense why- OCaml and Haskell are functional and were early proponents of these type systems. But, languages like Racket don’t have these type systems and the article doesn’t do anything to explain why they are _also_ better for reliability.
conartist6•1h ago
You don't need a strong type system or even really ANY compile-time type system for this strategy to work! I use all these techniques in plain JS and I can still get the benefits of correct-by-construction code style just by freezing objects and failing fast.
bdangubic•38m ago
godspeed with that :)
agumonkey•36m ago
Is this a methodology you use at work or only for personal projects ? I'm curious how common this culture is among companies/teams.
conartist6•2m ago
I'm not personally aware of any companies doing this in plain JS aside from my own (I am co-founder/CEO of a two-person startup). I really like working in plain JS. It feels malleable where TS code feels brittle, almost crystalline. Even though I don't have compile-time types there's still only a small handful of different shapes of objects in the core of my software (far fewer than the average TS codebase, I'd wager), and it shouldn't take long at all for people to learn the highly consistent naming conventions that tip you off to what type of data is being handled. The result is that I'd expect that it would only be a handful of days learning the mental model for the codebase before the average person would find it far easier to read the JS code as opposed to the TS code due to the reduced visual clutter.

I also ship code super fast. When I find bugs I just fix them on the spot, with the result that I often smash bugfixes and features together and have a messy git history, but on the flip side you'll never find bugs that I've left sitting for years. If something is wrong and I can reproduce it (usually easy in functional code), the debugger and I are going to get to the bottom of it, and quickly.

aag•56m ago
Thank you for saying that. I regularly attend the International Conference on Functional Programming, which grew out of the LISP and Functional Programming conference. Except for the Scheme Workshop, which is the reason I attend, it might as well be called the International Conference on Static Types. Almost all of the benefits of functional programming come from functional programming itself, not from static types, but one would never get that impression from the papers presented there. The types are all that anyone talks about.
acdha•53m ago
Yeah, I know Rust isn’t everyone’s favorite but I’d expect at least some awareness that we’ve seen a lot of reliability improvements due to many of these ideas in a language which isn’t focused on FP. I ended up closing the tab when they had the example in TypeScript pretending the fix was result types rather than validation: that idea could be expressed as preferring that style, an argument that it makes oversights less likely, etc. but simply ignoring decades and decades of prior art suggests the author either isn’t very experienced or is mostly motivated by evangelism (e.g. COBOL didn’t suffer from the example problem before the first FP language existed so a far more interesting discussion would be demonstrating awareness of alternatives and explaining why this one is better).
saghm•42m ago
I've seen it pointed out that the main point of functional programming is immutability, and that the benefits mostly flow from that. I haven't really learned much of any lisp dialect, but my (admittedly fuzzy) general perception is that this is also the preferred way to work in them, so my guess is that's where the benefit in reliability might come from.
zelphirkalt•39m ago
Correct. If things are mutable, then in most languages, there can be spooky action at a distance, that mutates some field of some other object or does so indirectly via some calls. This then can change how the thing behaves in other circumstances. This style of programming quickly becomes hard to fully grasp and leads to humans making many mistakes. Avoiding mutation therefore avoids these kinds of faults and mistakes.
charcircuit•1h ago
>In banking, telecom, and payments, reliability is not a nice to have. It is table stakes.

This reliability isn't done by being perfect 100% of the time. Things like being able to handle states where transactions don't line up allowing for payments to eventually be settled. Or for telecom allowing for single parts of the system to not take down the whole thing or adding redundancy. Essentially these types of businesses require fault tolerance to be supported. The real world is messy, there is always going to be faults, so investing heavily into correctness may not be worth it compared to investing into fault tollerance.

discarded1023•45m ago
You'd like to know your fault tolerance is reliable and possibly even correct.
wewewedxfgdf•58m ago
I'm wary of absolute statements about programming.
ggm•51m ago
I want to be a contrarian and argue with this, but my daily praxis is generally to take a betteridges law approach to most argumentative absolutes and also false dichotomous headlines and question them. Reading the other comments to the effect that the conferences are now strong typing gabfests and insufficiently about FP per se reinforced this feeling.

Reliability should be simpler with FP but so much depends on correctness of the runtime and IO.

Erlang and the "run correctly or die" comes to mind as well. The system is either working or is off. When being off is fatal, Erlang seems to shrug and say "maybe next karmic cycle" maybe this too is a better approach?

henning•55m ago
I like good type systems, too, but they won't save you from bugs that are better addressed by fuzz testing, fault injection testing and adversarial mindset shifts.
saghm•41m ago
Luckily these aren't exclusive! You can do all of those things with a strong type system as well, and get the benefits of all of them.
d--b•41m ago
Strong types: yes, it’s definitely better

Functional programming: no, functional programming as in: the final program consists in piping functions together and calling the pipe. In my opinion, that tends to get in the way of complex error handling.

The problem being that raising Exceptions at a deep level and catching them at some higher level is not pure functional programming. So your code has to deal with all the cases. It is more reliable if you can do it, but large systems have way too many failure points to be able to handle them all in a way that is practical.

zelphirkalt•34m ago
If you have strong types, it is still possible to make a mutable thing, that will be mutated from the other end of the program and that will introduce bugs, that can be hard to find. If you are doing FP on the other hand, at least change always results in new objects, with structural sharing at most. This excludes a whole category of bugs.
Jensson•11m ago
> If you are doing FP on the other hand, at least change always results in new objects, with structural sharing at most. This excludes a whole category of bugs.

Not if you program it with a mutable god object to mimic creating a new big state, then you have exactly the same kind of issues.

The issue is if you try to program a transaction flow using object oriented programming, that is not very good, and most work programmers do revolves around involves flows. But when it doesn't then functional programming isn't a very good or reliable solution.

breadwinner•16m ago
> that tends to get in the way of complex error handling.

Agree. In Java, Streams allow you to process collections in a functional style. This feature enables concise, expressive data manipulation with operations like map, filter, and reduce.

Some people point out that Java's checked exceptions spoil the simplicity and elegance of Streams by forcing you to handle exceptions.

But that's not a reason to not have checked exceptions, it is a reason to not do functional style composition when methods can throw exceptions. Streams was invented for collections, which tend not to throw exceptions. If proper error handling is important don't do Streams.

cubefox•37m ago
I think there is a strong case that ADTs (algebraic data types) aren't so great after all. Specifically, the "tagged" unions of ADT languages like Haskell are arguably pretty clearly inferior to the "untagged" unions of TypeScript or Scala 3. Because the latter actually behave like a logical "or" rather than an artificial construct that needs to be wrapped and unwrapped.
jesse__•20m ago
> "tagged" unions of ADT languages like Haskell are arguably pretty clearly inferior to the "untagged" unions of TypeScript

dude .. wut?? Explain to me exactly how this is true, with a real world example.

From where I stand, untagged unions are useful in an extremely narrow set of circumstances. Tagged unions, on the other hand, are incredibly useful in a wide variety of applications.

pastel8739•8m ago
Most of the time when I use untagged unions, I end up adding a tag and logic to case on it anyway…
whateveracct•27m ago
> In banking, telecom, and payments, reliability is not a nice to have. It is table stakes.

Haha as someone who has worked in one of these domains using FP even - I wish the people in charge agreed with you!

Reliability is a cost center and Product-oriented Builders treat it as such.

thundergolfer•2m ago
All the line items are decent things, worth doing, but the claim about how much following the line items would improve reliability is super exaggerated.

> [Most production incidents] are due to the code entering a state that should never have been possible.

I have never seen evidence that this is even remotely true, and I've been looking at software reliability research in the last few months.

Instead, it is more true that most production incidents are due to the system entering into one of thousands of unsafe states which were possible and latent in production potentially for years. In a sufficiently complex system—all interesting and important software projects—functional programming is not strong enough a tool to prevent even a sliver of potential accidents.

> Arguments that these degraded conditions should have been recognized before the overt accident are usually predicated on naïve notions of system performance. System operations are dynamic, with components (organizational, human, technical) failing and being replaced continuously. — https://how.complexsystems.fail/

Face Antispoof ONNX

https://github.com/johnraivenolazo/face-antispoof-onnx
1•handfuloflight•4m ago•0 comments

Video Essays of 2025

https://www.bfi.org.uk/sight-and-sound/polls/best-video-essays-2025
1•vinhnx•9m ago•0 comments

Why are we worried about memory access semantics? Full barriers are enough?

https://devblogs.microsoft.com/oldnewthing/20251226-00/?p=111919
1•signa11•10m ago•0 comments

Publishers Clearing House's bankruptcy means winners will no longer get paid

https://www.cnn.com/2025/09/16/business/publishers-clearing-house-bankruptcy-winners-lose-prizes
1•petethomas•13m ago•0 comments

The Well Watchers

https://www.motherjones.com/environment/2025/12/abandoned-oil-wells-texas-tiktok-hawk-dunlap-sara...
1•toomuchtodo•19m ago•0 comments

Ask HN: Can systems function correctly without memory?

1•SpicyG•20m ago•0 comments

The iOS Weekly Brief – Issue #40

https://vladkhambir.substack.com/p/the-ios-weekly-brief-issue-40
1•khambir•21m ago•0 comments

Andrej Karpathy: "I've never felt this much behind as a programmer"

https://twitter.com/i/status/2004607146781278521
1•alexcos•27m ago•2 comments

Geographic shapes and flags via simple URLs

https://borderly.dev/
1•zuhayeer•27m ago•0 comments

GitHub Takes Down Rockchip MPP Repository After FFmpeg Copyright Claim

https://linuxiac.com/github-takes-down-rockchip-mpp-repository-after-ffmpeg-copyright-claim/
1•marcodiego•29m ago•0 comments

Lost Years: Expected Number of Years Lost

https://github.com/gojiplus/lost-years
1•neehao•32m ago•0 comments

Ask HN: Why does YouTube collect creator demographics?

1•journal•37m ago•0 comments

Make Your iPhone Speak the Time

https://swordandsignals.com/2025/12/27/announce-time-on-demand.html
1•jiannengli•39m ago•0 comments

Show HN: tpmjs - npm for ai sdk tools

https://tpmjs.com/
2•thomasfromcdnjs•41m ago•1 comments

Dad's Fitness May Be Packaged and Passed Down in Sperm RNA

https://www.quantamagazine.org/how-dads-fitness-may-be-packaged-and-passed-down-in-sperm-rna-2025...
17•vismit2000•1h ago•2 comments

Change, How Expensive

https://johnocens.com/soothfare/changehowexpensive
2•wonderbar•1h ago•0 comments

Bluetooth Headphone Jacking: Full Disclosure of Airoha Race Vulnerabilities

https://insinuator.net/2025/12/bluetooth-headphone-jacking-full-disclosure-of-airoha-race-vulnera...
2•marvinborner•1h ago•1 comments

2026 macro outlook – views across the street (synthesis 2026 outlook reports)

https://2026macro.vercel.app/
1•OxfordOutlander•1h ago•1 comments

Would You Kill for a Job?

https://www.nytimes.com/2025/12/27/opinion/no-other-choice-work-unemployment.html
2•mitchbob•1h ago•4 comments

Replacing JavaScript with Just HTML

https://www.htmhell.dev/adventcalendar/2025/27/
81•soheilpro•1h ago•18 comments

The case of Africa's 'vanishing' carbon deals

https://www.japantimes.co.jp/environment/2025/11/26/climate-change/africa-carbon-deals/
1•PaulHoule•1h ago•0 comments

Software ate the world. Federation will eat embeddings

https://www.gnanaguru.com/p/federation-over-embeddings-let-ai
2•gnanagurusrgs•1h ago•1 comments

Nature and Climate Wins in 2025

https://www.bbc.com/future/article/20251212-seven-quiet-wins-for-climate-and-nature-in-2025
1•kaycebasques•1h ago•0 comments

Show HN: I created a tool to design and create foamcore inserts for boardgames

https://boxinsertdesigner.com/
1•Rabidgremlin•1h ago•0 comments

Show HN: Iris – an AI-powered rental search built specifically for San Francisco

https://www.irisrents.com
2•manan08•1h ago•1 comments

Go Memory Model Deep Dive: What Every Go Developer Must Know

https://skoredin.pro/blog/golang/go-memory-model-deep-dive
1•ibobev•1h ago•0 comments

Building a Plugin System in Go: Make Your Monolith Extensible

https://skoredin.pro/blog/golang/go-plugin-system
1•ibobev•1h ago•0 comments

1Password Chrome extension is incorrectly manipulating <code> blocks

https://www.1password.community/discussions/developers/1password-chrome-extension-is-incorrectly-...
3•josephscott•1h ago•1 comments

Vaccinated dog tests positive for rabies, at least 13 people PEP so far

https://www.cookcountyil.gov/news/cook-county-department-animal-and-rabies-control-confirms-rabie...
19•stockresearcher•1h ago•2 comments

Realtime Raytracing in Bevy 0.18 (Solari)

https://jms55.github.io/posts/2025-12-27-solari-bevy-0-18/
1•ibobev•1h ago•0 comments