Links

Philip Wadler


A practical theory of language-integrated query

James Cheney, Sam Lindley, Philip Wadler. ICFP 2013.

Language-integrated query is receiving renewed attention, in part because of its support through Microsoft's LINQ framework. We present a theory of language-integrated query based on quotation and normalisation of quoted terms. Our technique supports abstraction over values and predicates, composition of queries, dynamic generation of queries, and queries with nested intermediate data. Higher-order features prove useful even for constructing first-order queries. We prove that normalisation always succeeds in translating any query of flat relation type to SQL. We present experimental results confirming our technique works, even in situations where Microsoft's LINQ framework either fails to produce an SQL query or, in one case, produces an avalanche of SQL queries.

Earlier versions of this paper were named "The essence of language-integrated query"

Available in: pdf, doi, supplementary materials and code, FP Days slides, FP Days video, SCRIPT workshop slides.


The arrow calculus

Sam Lindley, Philip Wadler, and Jeremy Yalloop, Journal of Functional Programming 20(1):51&em;69, 2010.

We introduce the arrow calculus, a metalanguage for manipulating Hughes’s arrows with close relations both to Moggi’s metalanguage for monads and to Paterson’s arrow notation. Arrows are classically defined by extending lambda calculus with three constructs satisfying nine (somewhat idiosyncratic) laws; in contrast, the arrow calculus adds four constructs satisfying five laws (which fit two well-known patterns). The five laws were previously known to be sound; we show that they are also complete, and hence that the five laws may replace the nine.

Available in: pdf, doi.


The RPC Calculus

Ezra Cooper and Philip Wadler. Principles and Practice of Declarative Programming (PPDP), Coimbra, 2009.

Several recent language designs have offered a unified language for programming a distributed system, with explicit notation of locations; we call these "location-aware" languages. These languages provide constructs allowing the programmer to control the location (the choice of host, for example) where a piece of code should run, which can be useful for security or performance reasons. On the other hand, a central mantra of WWW system engineering prescribes that web servers should be "stateless": that no "session state" should be maintained on behalf of individual clients—that is, no state that pertains to the particular point of the interaction at which a client program resides. Many implementations of locationaware languages are not at home on the web: they hold some kind of client-specific state on the server. We show how to implement a symmetrical location-aware language on top of a stateless server.

Available in: pdf.
Slides from PPDP 09: pdf.


The Essence of Form Abstraction

Ezra Cooper, Sam Lindley, Philip Wadler, Jeremy Yallop. APLAS 2008.

Abstraction is the cornerstone of high-level programming; HTML forms are the principal medium of web interaction. However, most web programming environments do not support abstraction of form components, leading to a lack of compositionality. Using a semantics based on idioms, we show how to support compositional form construction and give a convenient syntax.

Available in: pdf.
Slides from BCS FACS seminar: pdf.


Idioms are oblivious, arrows are meticulous, monads are promiscuous

Sam Lindley, Philip Wadler, Jeremy Yallop. MSFP 2008.

We revisit the connection between three notions of computation: Moggi's monads, Hughes's arrows and McBride and Paterson's idioms (also called applicative functors). We show that idioms are equivalent to arrows that satisfy the type isomorphism A ~> B = 1 ~> (A -> B) and that monads are equivalent to arrows that satisfy the type isomorphism A ~> B = A -> (1 ~> B). Further, idioms embed into arrows and arrows embed into monads.

Available in: pdf.


The arrow calculus (Functional pearl)

Sam Lindley, Philip Wadler, Jeremy Yallop. Submitted to ICFP 2008.

We introduce the arrow calculus, a metalanguage for manipulating Hughes's arrows with close relations both to Moggi's metalanguage for monads and to Paterson's arrow notation.

Available in: pdf.


An idiom's guide to formlets

Ezra Cooper, Sam Lindley, Philip Wadler, and Jeremy Yallop. Submitted to ICFP 2008.

Formlets in Links decouple user interface from data, a vital form of abstraction supported by very few web frameworks. Formlets are best defined in terms of idioms, not monads or arrows as one might suppose from the existing literature.

Available in: pdf.


Signed and sealed

Philip Wadler and Jeremy Yallop. Submitted to ICFP 2008.

Language constructs for defining abstract types commonly come in two varieties: those that add and remove seals dynamically as values cross the abstraction boundary, and those that define the boundary statically using a type signature. Abstract types in dynamically-typed languages are generally defined using seals whereas statically-typed languages more typically use a signature; two prominent exceptions are Haskell, which uses seals, and Standard ML, which provides for both styles.

We show that the two styles are interconvertible, and give a proof based on Pitts' formulation of relational parametricity. In the light of this equivalence we revisit the decision to use seals for abstract types in Haskell and describe a library which extends Haskell with a construct for defining abstract types using signatures by a translation which inserts seals as necessary.

Available in: pdf.


A located lambda calculus

Ezra Cooper and Philip Wadler. Submitted to ICFP 2008.

Several recent language designs have offered a unified language for programming a distributed system; we call these "location-aware" languages. These languages provide constructs that allow the programmer to control the location (the choice of host, for example) where a piece of code should run, which can be useful for security or performance reasons. On the other hand, a central mantra of web engineering insists that web servers should be "stateless": that no "session state" should be maintained on behalf of individual clients---that is, no state that pertains to the particular point of the interaction at which a client program resides. Thus far, most implementations of unified location-aware languages have ignored this precept, usually keeping a process for each client running on the server, or otherwise storing state information in memory. We show how to implement a location-aware language on top of the stateless-server model.

Available in: pdf.


Comprehensive comprehensions

Simon Peyton Jones and Philip Wadler. Haskell workshop, ICFP, Freiburg, 30 September 2007.

We propose an extension to list comprehensions that makes it easy to express the kind of queries one would write in SQL using ORDER BY, GROUP BY, and LIMIT. Our extension adds expressive power to comprehensions, and generalises the SQL constructs that inspired it. It is easy to implement, using simple desugaring rules.

Available in: pdf.


Links: Web programming without tiers

Ezra Cooper, Sam Lindley, Philip Wadler, Jeremy Yallop. FMCO, Amsterdam, November 2006.

Links is a programming language for web applications that generates code for all three tiers of a web application from a single source, compiling into JavaScript to run on the client and into SQL to run on the database. Links supports rich clients running in what has been dubbed Ajax style, and supports concurrent processes with statically-typed message passing. Links is scalable in the sense that session state is preserved in the client rather than the server, in contrast to other approaches such as Java Servlets or PLT Scheme. Client-side concurrency in JavaScript and transfer of computation between client and server are both supported by translation into continuation-passing style.

Available in: pdf.


Links

Philip Wadler. Seminar: Cambridge, 9 Feb 2005; York, 11 May 2005.

A typical web system is organized in three tiers, each running on a separate computer. Middle-tier logic on the server generates forms to send to a front-end browser and queries to send to a back-end database. The programmer must master a myriad of languages: the logic is written in a mixture of Java, Python, and Perl; the forms in HTML, XML, and Javascript; and the queries are written in SQL or XQuery. There is no easy way to link these --- to be sure that a form in HTML or a query in SQL produces data of a type that the logic in Java expects --- this is called the impedance mismatch problem. Links collapses this Tower of Babel by providing a single source that compiles into Javascript, Java, SQL, and XQuery, among others. Links builds on previous successes with functional languages, incorporating support for database programming from Kleisli, for XML programming from Xduce, for web interaction from Scheme and Haskell, and for distributed programming from Erlang.

Available in: pdf.


Philip Wadler,