Is Functional Programming Better for Modularity?

Published in Workshop on Evaluation and Usability of Programming Languages and Tools, 2015

Abstract

In 1989 John Hughes published an influential position paper entitled Why Functional Programming Matters. The article extolls the virtues of lazy functional programming by developing several examples: the Newton-Rhapson squares root method, numerical differentiation and integration, and an alpha-beta minimax search. A main conclusion of that work is that higher-order functions and lazy evaluation significantly contribute to modularity. We have found that recent articles from 2010 to 2014 cite Hughes’ work as seminal work supporting that functional programming is, in general, good for modularity. We believe this reflects an unstated hypothesis in part of the research community: functional programming is inherently better at modularity than other paradigms such as typical procedural and object-oriented programming. To the best of our knowledge there are no (large-scale) empirical evaluations of this characteristic. We discuss the influence of Why Functional Programming Matters on current beliefs regarding the advantages of functional programming, the recent citations that intrigues us, and provide a small experiment on the GHC Haskell compiler, suggesting the existence of modularity issues in it.