Efficient Declarative Programming in OCaml - Silvério, Diogo Rafael Rebocho (2022)
Software gets more complex each day, specially with the growing popularity of IoT, Par- allel Computing and interactive web applications. The opportunity for error grows hand in hand with the ever growing complexity of these systems. Declarative programming allows developers to focus on solving a problem and avoid the complexity of dealing with programming low-level elements, such as memory management. Unfortunately, some pure declarative programs tend to perform poorly from an execu- tional point of view compared with their equivalent imperative counterparts. These are more machine-friendly which turns the use of declarative programming less appealing to the general audience. The goal of this dissertation is to create several OCaml PPX (PreProcessor eXtension) rewriters that transform purely declarative OCaml programs into equivalent ones with better executional performance. These PPX rewriters allow the user to automatically improve the performance of their code. Our biggest aim is to promote the use of the declarative paradigm. The motivation is two-fold: one, developers can enjoy natural, intuitive, and elegant declarative solutions to their problems; second, increase code cor- rectness, decrease code size and ease code verification.