Perish or Flourish? A Holistic Evaluation of Large Language Models for Code Generation in Functional Programming

Lang Hong Nguyet Anh, Eric Lang, Bach Le, Huynh Quyet Thang, Thanh Le-Cong


Abstract
Functional programming provides strong foundations for developing reliable and secure software systems, yet its adoption remains limited because of its steep learning curve. Recent advances in Large Language Models (LLMs) for code generation present new opportunities to lower these barriers. However, most evaluations of LLMs focus on imperative programming languages, and their capabilities in functional programming languages remain under-explored. To address this gap, we introduce FPEval, a holistic evaluation framework equipped with FPBench, a new benchmark of 721 programming tasks across three difficulty levels and three mainstream functional programming languages: Haskell, OCaml, and Scala. FPEval combines comprehensive executable test suites with static-analysis tools to assess both functional correctness and code style and maintainability. Using this framework, we evaluate seven state-of-the-art LLMs, including GPT-5 and Claude Opus 4.6, on functional programming tasks, with Java included as an imperative baseline. Our results demonstrate that LLM performance in functional programming improves substantially with model advancement; however, error rates remain significantly higher in functional-first languages (Haskell and OCaml) than in hybrid (Scala) or imperative (Java) languages. More critically, LLMs frequently generate non-idiomatic functional code that follows imperative patterns, raising concerns about code style and maintainability. Finally, we show that LLMs can partially self-repair both correctness and quality issues when provided with static-analysis feedback and hand-crafted instructions targeting common issue types, paving the way for future improvements.
Anthology ID:
2026.findings-emnlp.710
Volume:
Findings of the Association for Computational Linguistics: EMNLP 2026
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
Findings
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
14903–14925
Language:
URL:
https://aclanthology.org/2026.findings-emnlp.710/
DOI:
Bibkey:
Cite (ACL):
Lang Hong Nguyet Anh, Eric Lang, Bach Le, Huynh Quyet Thang, and Thanh Le-Cong. 2026. Perish or Flourish? A Holistic Evaluation of Large Language Models for Code Generation in Functional Programming. In Findings of the Association for Computational Linguistics: EMNLP 2026, pages 14903–14925, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
Perish or Flourish? A Holistic Evaluation of Large Language Models for Code Generation in Functional Programming (Anh et al., Findings 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.findings-emnlp.710.pdf