Stephan van Hulst wrote:At the risk of sounding very dumb, I'm gonna say that my intuition tells me that using purely functional languages in a large project or team is going to be extremely difficult.
As someone with 25kloc Clojure in production, I'll say that we're finding maintenance of our Clojure code a lot easier than our previous OOP code base. The Clojure code is substantially shorter, uses higher level abstractions and expressivity, and the immutable data / pure function approach means far fewer bugs, far easier concurrency, and code that is generally much easier to reason about and to debug.
That said, it does seem that working with a (large) Functional code base requires smarter programmers -- because you're dealing with more abstractions and you generally have to think more about your solutions (because you can't just bash out some "obvious" simple imperative code). On the other hand, Functional code lets you do a lot more with less code and fewer developers, because it is much more expressive than mainstream (OOP) languages. We've seen about a 2-5x "compression" with Clojure compared to previous languages we've used. Some folks claim Clojure is 4-10x shorter than
Java. That makes our code base equivalent to 100-250kloc Java.
Haskell has the additional benefit of a very strong type system that eliminates another whole class of errors, above and beyond those eliminated by pure functions and immutable data.
I know several companies (here in the Bay Area) that have extensive code bases written in Clojure, Haskell, Elm etc, and they all seem pretty happy with their decision to use FP. Facebook's new spam filtering system is written in Haskell, as an example.