Fluent APIs in Functional Languages (full version)

Authors: Ori Roth, Yossi Gil

License: CC BY 4.0
AI-generated keywords: Functional Programming Fluent API Parametric Polymorphism Type Inference DSL

AI-generated Key Points

  • The paper presents a methodology for creating smart and elegant APIs in functional programming languages.
  • The approach enforces the API protocol or DSL syntax at compile time by performing language recognition at the type level.
  • Parametric polymorphism and type inference are used to create functional fluent APIs that support all regular and deterministic context-free API protocols and beyond.
  • An HTML EDSL is embedded as an SML expression using their EDSL, which closely resembles HTML with minimal syntactic overhead imposed by the host programming language.
  • The proposed methodology does not rely on a specific language feature, making it compatible with most statically-typed functional languages.
  • It uses automata specifications for API protocols instead of external tools or dedicated language features.
  • By embedding DSLs as fluent APIs, developers can leverage the power of statically-typed functional languages while ensuring that their code adheres to strict protocol requirements at compile time.
Also access our AI generated: Comprehensive summary, Lay summary, Blog-like article; or ask questions about this paper to our AI assistant.

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.

Submitted to arXiv on 02 Nov. 2022

Tools for this paper

Explain it differently 3 free rewrites left today
Export BibTeX · RIS (Zotero, Mendeley, EndNote) · Markdown (Notion, Obsidian) · Premium
Citation alerts Premium
Journal club Slides to present it Premium
For journalists Press kit and hype check Premium

Ask questions about this paper to our AI assistant

You can also chat with multiple papers at once here.

AI assistant instructions?

Results of the summarizing process for the arXiv paper: 2211.01473v2

  • Comprehensive Summary
  • Key points
  • Layman's Summary
  • Blog article
This paper presents a methodology for creating smart and elegant APIs in functional programming languages. The proposed approach enforces the API protocol or DSL syntax at compile time by performing language recognition at the type level. Unlike traditional fluent API designs that rely on function overloading, this methodology uses parametric polymorphism and type inference to create functional fluent APIs that support all regular and deterministic context-free API protocols and beyond. The authors demonstrate their approach by embedding an HTML document as an SML expression using their EDSL. This HTML EDSL is both elegant and smart, closely resembling HTML with minimal syntactic overhead imposed by the host programming language. The EDSL coerces the SML compiler into enforcing HTML's syntax, ensuring that invalid webpages do not compile. The tags must appear in the correct order, every opening tag must have a matching closing tag, and all table rows must have the same number of columns. The proposed methodology does not rely on a specific language feature, making it compatible with most statically-typed functional languages. It also differs from other approaches such as typestates or static analysis methods for enforcing API protocols specified by context-free grammars, as it uses automata specifications for API protocols instead of external tools or dedicated language features. Overall, this paper offers valuable insights into creating functional fluent APIs using parametric polymorphism and type inference instead of overloading. By embedding DSLs as fluent APIs, developers can leverage the power of statically-typed functional languages while ensuring that their code adheres to strict protocol requirements at compile time.

Assess the quality of the AI-generated content by voting

Score: 0

Why do we need votes?

Votes are used to determine whether we need to re-run our summarizing tools. If the count reaches -10, our tools can be restarted.

The previous summary was created more than a year ago and can be re-run (if necessary) by clicking on the Run button below.

Similar papers summarized with our AI tools

Navigate through even more similar papers through a

tree representation

Disclaimer: The AI-based summarization tool and virtual assistant provided on this website may not always provide accurate and complete summaries or responses. We encourage you to carefully review and evaluate the generated content to ensure its quality and relevance to your needs.