HeadlinesBriefing favicon HeadlinesBriefing.com

Datafun: Merging Datalog with Functional Programming

Hacker News •
×

PhD researcher Neel Krishnaswami finalized a 97‑page dissertation titled Deconstructing Datalog in September 2022. The work fuses the compact logic language Datalog with typed functional programming, producing a new system called Datafun. By modeling recursive queries as least fix‑points, the paper demonstrates that Datalog’s power can coexist with modern type safety in software engineering practice.

Datafun rewrites Datalog’s reachability example into a set‑theoretic inequality, then into a lambda expression that invokes a least‑prefix operator. The type system tracks monotonicity, ensuring every recursive query satisfies Datalog’s stratification rule. This compositional approach lets programmers reason about recursion without sacrificing performance or expressiveness for large codebases in production environments today and tomorrow here.

Efficiency hinges on seminaïve iteration, which tracks only frontier changes instead of recomputing whole relations. By applying incremental lambda calculus, Datafun reduces the quadratic blowup seen in naïve breadth‑first search. The dissertation shows that these optimizations keep the system asymptotically fast while preserving Datalog’s declarative semantics for modern databases today in enterprise settings everywhere now.

Krishnaswami credits advisor Neel Krishnaswami and peers for sparking the idea, while examiners Achim Jung and Jeremy Gibbons refined the categorical foundations. The thesis, free of formal acknowledgments, underlines a simple truth: blending logical rigor with functional abstraction yields tools that scale, proving Datalog’s legacy endures in contemporary compiler research for data analysis and query.