Live data from Hacker News

Functional programming and reliability: ADTs, safety, critical infrastructure

blog.rastrian.dev

31–40 of 191 posts

Re: Functional programming and reliability: ADTs, safety, critical infrastructure

#31

It's acceptable to state, without evidence, that functional programming and static typing make things more reliable. But this isn't a falsifiable claim. We cannot possibly know if this is true or not. - Not all of banking and telecom use functional programming or even static typing. - Functional programming often leads to write-only incomprehensible code; the exact opposite of what you need to have a reliable system.…

It improves reliability at compile time, certainly

Re: Functional programming and reliability: ADTs, safety, critical infrastructure

#32
post #13
post #7

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.

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.

[dead]

Re: Functional programming and reliability: ADTs, safety, critical infrastructure

#33
post #12

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…

> 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 checke…

Yes, they are really a poor emulation of scala which makes it a bit more usable.

Re: Functional programming and reliability: ADTs, safety, critical infrastructure

#35
post #13
post #7

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.

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.

100%. Types don’t replace fuzzing, property tests, chaos, or adversarial thinking. They just move one slice of bugs from runtime to compile time and make refactors safer.

In hindsight I should have positioned types/ADTs as one layer in the reliability toolbox, not the toolbox.

Re: Functional programming and reliability: ADTs, safety, critical infrastructure

#36

It's acceptable to state, without evidence, that functional programming and static typing make things more reliable. But this isn't a falsifiable claim. We cannot possibly know if this is true or not. - Not all of banking and telecom use functional programming or even static typing. - Functional programming often leads to write-only incomprehensible code; the exact opposite of what you need to have a reliable system.…

> There's no hard evidence that static typing improves reliability.

I'm curious how you came to that conclusion?

https://pleiad.cl/papers/2012/kleinschmagerAl-icpc2012.pdf

https://www.deepdyve.com/lp/springer-journals/an-empirical-s...

Re: Functional programming and reliability: ADTs, safety, critical infrastructure

#37

>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 business…

Agree with the framing: in payments/telecom, reliability is often achieved via fault tolerance + reconciliation more than “perfect correctness.”

My point is narrower: those mechanisms still benefit from making illegal transitions unrepresentable (e.g. explicit state machines) so your retries/idempotency don’t create new failure modes. It’s not correctness vs tolerance, it’s correctness inside tolerant designs.

Re: Functional programming and reliability: ADTs, safety, critical infrastructure

#38
post #8
post #2

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.

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…

Rust certainly isn't a pure fp language, but the borrow checkerbl is a lot kinder when you use fp style.

Re: Functional programming and reliability: ADTs, safety, critical infrastructure

#39

It's acceptable to state, without evidence, that functional programming and static typing make things more reliable. But this isn't a falsifiable claim. We cannot possibly know if this is true or not. - Not all of banking and telecom use functional programming or even static typing. - Functional programming often leads to write-only incomprehensible code; the exact opposite of what you need to have a reliable system.…

> There's no hard evidence that static typing improves reliability. I'm curious how you came to that conclusion? https://pleiad.cl/papers/2012/kleinschmagerAl-icpc2012.pdf https://www.deepdyve.com/lp/springer-journals/an-empirical-s...

I was searching for the Stefik article to argue here, thank you.

Re: Functional programming and reliability: ADTs, safety, critical infrastructure

#40

It's acceptable to state, without evidence, that functional programming and static typing make things more reliable. But this isn't a falsifiable claim. We cannot possibly know if this is true or not. - Not all of banking and telecom use functional programming or even static typing. - Functional programming often leads to write-only incomprehensible code; the exact opposite of what you need to have a reliable system.…

> There's no hard evidence that static typing improves reliability. I'm curious how you came to that conclusion? https://pleiad.cl/papers/2012/kleinschmagerAl-icpc2012.pdf https://www.deepdyve.com/lp/springer-journals/an-empirical-s...

I don't consider a human subjects study to be "hard evidence".

So, we can safely disregard these papers. They got exactly the result that they sought out to get, and the papers were published because they confirmed the preexisting groupthink.

Post reply on HN