| >Functional code tends to be shorter than procedural code Shorter is one metric that FP "tends" to be better at. But it's not definitive. Who says procedural programs can't be shorter? And also is shorter necessarily better? Also does it come at the cost of readability? Actually let's not get into readability as it's not exactly measure-able. >Haskell's type system keeps track of what's going on and alerts you when you try to do something that doesn't make sense. Algebraic Type systems are indeed a measure-able metric when you measure correctness, amount of errors or total possible programs you can write. It restricts the code you can compile to be correct from a typed perspective. Meaning that out of all the possible programs you can write, Haskell allows you to write less programs in the sense that it stops you from writing certain incorrect programs. However, ADT's can be used in procedural programs or OOP programs as well. See Rust. What I want to know is specifically about the functional programs. In the functional programming paradigm what is the quantify-able metric that makes it definitively better? |
Rust isn't OOP. Funnily, it's type system is pretty much the same as Haskell's but stops just before higher kinded types.
Ignoring type systems and just looking at functional vs imperative, the advantage for functional is immutability making functions easier to reason about. Haskell in particular is also lazy, and therefore enables you to not be concerned with evaluation order.