HackerPapers

arXiv:2211.01473cs.PL

Fluent APIs in Functional Languages (full version)

Ori Roth, Yossi Gil

Abstract

Fluent API is an object-oriented pattern for elegant APIs and embedded DSLs. A smart fluent API can enforce the API protocol or DSL syntax at compile time. As fluent API designs typically rely on function overloading, they are hard to realize in functional programming languages. We show how to write functional fluent APIs using parametric polymorphism and type inference instead of overloading. Our designs support all regular and deterministic context-free API protocols and beyond.

arXiv comments
Journal reference
DOI
doi:10.1145/3586057
Subjects
cs.PLProgramming Languages

On Hacker News

Linked by 2 identifiable commenters in 2 comments across 2 threads, from Jun 2023 to Jan 2026. Found in 1 HN submission from Nov 2022 to Nov 2022. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments2 threads

    • There are a few approaches if you want to write a new language. One, as the author argues, is to write a library in an existing language, which may require sacrificing ergonomics to fit inside the syntax of the host language, but is safe, modular and reusable. Many DSLs can be…

      bmc7505View on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.