# Philip Wadler's research while affiliated with The University of Edinburgh and other places

## Publications (183)

Chapter
Two recent exciting trends in programming languages are gradual types and algebraic effect handlers. Several steps are required to bring algebraic effect handlers to wider use, one of the most important being the development of a suitable gradual type system.
Article
Full-text available
C#, Dart, Pyret, Racket, TypeScript, VB: many recent languages integrate dynamic and static types via gradual typing. We systematically develop four calculi for gradual typing and the relations between them, building on and strengthening previous work. The calculi are as follows: $\lambda{B}$ , based on the blame calculus of Wadler and Findler (200...
Article
Chapter
User-defined tokens—both fungible ERC-20 and non-fungible ERC-721 tokens—are central to the majority of contracts deployed on Ethereum. User-defined tokens are non-native on Ethereum; i.e., they are not directly supported by the ledger, but require custom code. This makes them unnecessarily inefficient, expensive, and complex. The Extended UTXO Mod...
Chapter
A prominent use case of Ethereum smart contracts is the creation of a wide range of user-defined tokens or assets by way of smart contracts. User-defined assets are non-native on Ethereum; i.e., they are not directly supported by the ledger, but require repetitive custom code. This makes them unnecessarily inefficient, expensive, and complex. It al...
Chapter
Full-text available
Bitcoin and Ethereum, hosting the two currently most valuable and popular cryptocurrencies, use two rather different ledger models, known as the UTXO model and the account model, respectively. At the same time, these two public blockchains differ strongly in the expressiveness of the smart contracts that they support. This is no coincidence. Ethere...
Article
Consider two widely used definitions of equality. That of Leibniz: one value equals another if any predicate that holds of the first holds of the second. And that of Martin-Löf: the type identifying one value with another is occupied if the two values are identical. The former dates back several centuries, while the latter is widely used in proof s...
Preprint
We describe a design for generics in Go inspired by previous work on Featherweight Java by Igarashi, Pierce, and Wadler. Whereas subtyping in Java is nominal, in Go it is structural, and whereas generics in Java are defined via erasure, in Go we use monomorphisation. Although monomorphisation is widely used, we are one of the first to formalise it....
Article
Full-text available
Article
One of the leading textbooks for formal methods is Software Foundations (SF), written by Benjamin Pierce in collaboration with others, and based on Coq. After five years using SF in the classroom, we came to the conclusion that Coq is not the best vehicle for this purpose, as too much of the course needs to focus on learning tactics for proof deriv...
Preprint
Full-text available
Monads are a useful tool for structuring effectful features of computation such as state, non-determinism, and continuations. In the last decade, several generalisations of monads have been suggested which provide a more fine-grained model of effects by replacing the single type constructor of a monad with an indexed family of constructors. Most no...
Article
Full-text available
Session types are a rich type discipline, based on linear types, that lifts the sort of safety claims that come with type systems to communications. However, web-based applications and microservices are often written in a mix of languages, with type disciplines in a spectrum between static and dynamic typing. Gradual session types address this mixe...
Chapter
System F, also known as the polymorphic $$\lambda$$-calculus, is a typed $$\lambda$$-calculus independently discovered by the logician Jean-Yves Girard and the computer scientist John Reynolds. We consider $$F_{\omega \mu }$$, which adds higher-order kinds and iso-recursive types. We present the first complete, intrinsically typed, executable, fo...
Chapter
Lambda calculi are often used as intermediate representations for compilers. However, they require extensions to handle higher-level features of programming languages. In this paper we show how to construct an IR based on $$\text {System}\ F_{\omega }^\mu$$ which supports recursive functions and datatypes, and describe how to compile it to \(\text...
Preprint
Full-text available
Process calculi based in logic, such as $\pi$DILL and CP, provide a foundation for deadlock-free concurrent programming, but exclude non-determinism and races. HCP is a reformulation of CP which addresses a fundamental shortcoming: the fundamental operator for parallel composition from the $\pi$-calculus does not correspond to any rule of linear lo...
Chapter
Process calculi based in logic, such as DILL and CP, provide a foundation for deadlock-free concurrent programming, but exclude non-determinism and races. is a reformulation of CP which addresses a fundamental shortcoming: the fundamental operator for parallel composition from the -calculus does not correspond to any rule of linear logic, and there...
Article
Implicit programming (IP) mechanisms infer values by type-directed resolution, making programs more compact and easier to read. Examples of IP mechanisms include Haskell’s type classes, Scala’s implicits, Agda’s instance arguments, Coq’s type classes and Rust’s traits. The design of IP mechanisms has led to heated debate: proponents of one school a...
Article
Full-text available
Gradual typing has emerged as the tonic for programmers with a thirst for a blend of static and dynamic typing. Contracts provide a lightweight form of gradual typing as they can be implemented as a library, rather than requiring a gradual type system. Intersection and union types are well suited to static and dynamic languages: intersection encode...
Preprint
Full-text available
Session types are a rich type discipline, based on linear types, that lifts the sort of safety claims that come with type systems to communications. However, web-based applications and microservices are often written in a mix of languages, with type disciplines in a spectrum between static and dynamic typing. Gradual session types address this mixe...
Article
We introduce Refinement Reflection, a new framework for building SMT-based deductive verifiers. The key idea is to reflect the code implementing a user-defined function into the function's (output) refinement type. As a consequence, at uses of the function, the function definition is instantiated in the SMT logic in a precise fashion that permits d...
Article
Full-text available
Quantified class constraints have been proposed many years ago to raise the expressive power of type classes from Horn clauses to the universal fragment of Hereditiary Harrop logic. Yet, while it has been much asked for over the years, the feature was never implemented or studied in depth. Instead, several workarounds have been proposed, all of whi...
Conference Paper
Full-text available
Quantified class constraints have been proposed many years ago to raise the expressive power of type classes from Horn clauses to the universal fragment of Hereditiary Harrop logic. Yet, while it has been much asked for over the years, the feature was never implemented or studied in depth. Instead, several workarounds have been proposed, all of whi...
Article
Welcome to the Proceedings of the ACM on Programming Languages (PACMPL)!
Article
Session types are a rich type discipline, based on linear types, that lift the sort of safety claims that come with type systems to communications. However, web-based applications and micro services are often written in a mix of languages, with type disciplines in a spectrum between static and dynamic typing. Gradual session types address this mixe...
Article
Full-text available
The polymorphic blame calculus integrates static typing, including universal types, with dynamic typing. The primary challenge with this integration is preserving parametricity: even dynamically-typed code should satisfy it once it has been cast to a universal type. Ahmed et al. (2011) employ runtime type generation in the polymorphic blame calculu...
Article
The data abstraction mechanism of Miranda may be adapted to a dynamically typed programming language by applying ideas from gradual typing.
Article
Full-text available
Channel- and actor-based programming languages are both used in practice, but the two are often confused. Languages such as Go provide anonymous processes which communicate using typed buffers---known as channels---while languages such as Erlang provide addressable processes each with a single incoming message queue---known as actors. The lack of a...
Conference Paper
Programming languages form the interface between programmers (the users) and the computation that they desire the computer to execute. Although studies exist for some aspects of programming language design (such as conditionals), other aspects have received little or no human factors evaluations. Designers thus have little they can rely on if they...
Article
This paper presents the insight that practical embedding techniques, commonly used for implementing Domain-Specific Languages, correspond to theoretical Normalisation-By-Evaluation (NBE) techniques, commonly used for deriving canonical form of terms with respect to an equational theory. NBE constitutes of four components: a syntactic domain, a sema...
Conference Paper
We describe a new approach to implementing Domain-Specific Languages(DSLs), called Quoted DSLs (QDSLs), that is inspired by two old ideas:quasi-quotation, from McCarthy's Lisp of 1960, and the subformula principle of normal proofs, from Gentzen's natural deduction of 1935. QDSLs reuse facilities provided for the host language, since host and quoted...
Article
Propositions as Types is closely related to the BHK Interpretation, a view of logic developed by the intuitionists Brouwer, Heyting, and Kolmogorov in the 1930s. It is often referred to as the Curry-Howard isomorphism, referring to a correspondence observed by Curry in 1934 and refined by Howard in 1969. It applies to a range of logics, including p...
Article
We describe a new approach to domain specific languages (DSLs), called Quoted DSLs (QDSLs), that resurrects two old ideas: quotation, from McCarthy's Lisp of 1960, and the subformula property, from Gentzen's natural deduction of 1935. Quoted terms allow the DSL to share the syntax and type system of the host language. Normalising quoted terms ensur...
Article
Full-text available
C#, Dart, Pyret, Racket, TypeScript, VB: many recent languages integrate dynamic and static types via gradual typing. We systematically develop three calculi for gradual typing and the relations between them, building on and strengthening previous work. The calculi are: lambda B, based on the blame calculus of Wadler and Findler (2009); lambda C, i...
Article
Scala supports actors and message passing with the Akka library. Though Scala is statically typed, messages in Akka are dynamically typed (that is, of type Any). The Akka designers argue that using static types is "impossible" because "actor behaviour is dynamic", and, indeed, it is not clear that important actor support, such as supervision or nam...
Article
Full-text available
Nested relational query languages have been explored extensively, and underlie industrial language-integrated query systems such as Microsoft's LINQ. However, relational databases do not natively support nested collections in query results. This can lead to major performance problems: if programmers write queries that yield nested results, then suc...
Conference Paper
Full-text available
Language-integrated query techniques have been explored in a number of different language designs. We consider two different, type-safe approaches employed by Links and F#. Both approaches provide rich dynamic query generation capabilities, and thus amount to a form of heterogeneous staged computation, but to date there has been no formal investiga...
Conference Paper
Language-integrated query is receiving renewed attention, in part because of its support through Microsoft's LINQ framework. We present a practical theory of language-integrated query based on quotation and normalisation of quoted terms. Our technique supports join queries, abstraction over values and predicates, composition of queries, dynamic gen...
Article
Continuing a line of work by Abramsky (1994), by Bellin and Scott (1994), and by Caires and Pfenning (2010), among others, this paper presents CP, a calculus in which propositions of classical linear logic correspond to session types. Continuing a line of work by Honda (1993), by Honda, Kubo, and Vasconcelos (1998), and by Gay and Vasconcelos (2010...
Article
This document summarizes my experience serving as a POPLï¾11 program chair. It is meant to assist future program chairs. See [1] for POPLï¾11 general chair report. I describe the process and estimate the time devoted for each phase, followed a brief ...
Article
Full-text available
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). Furth...
Conference Paper
Full-text available
Several programming languages are beginning to integrate static and dynamic typing, including Racket (formerly PLT Scheme), Perl 6, and C# 4.0 and the research languages Sage (Gronski, Knowles, Tomb, Freund, and Flanagan, 2006) and Thorn (Wrigstad, Eugster, Field, Nystrom, and Vitek, 2009). However, an important open question remains, which is how...
Article
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.
Article
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 con...
Conference Paper
A venerable line of research aims to provide a general-purpose programming language with a well-defined subset that compiles into efficient queries, perhaps by translation into SQL or some other suitable query language. This talk discusses some older and more recent advances in this direction, including the languages Kleisli, LINQ, Ferry, M, and Li...
Article
How to integrate static and dynamic types? Recent work focuses on casts to mediate between the two. However, adding casts may degrade tail calls into a non-tail calls, increasing space consumption from constant to linear in the depth of calls. We present a new solution to this old problem, based on the notion of a threesome. A cast is specified by...
Conference Paper
Full-text available
The blame calculus of Wadler and Findler gives a high-level semantics to casts in higher-order languages. The coercion calculus of Henglein, on the other hand, provides an instruction set for casts whose normal forms ensure space efficiency. In this paper we address two questions: 1) can space efficiency be obtained in a high-level semantics? and 2...
Article
A constraint programming system combines two essential components: a constraint solver and a search engine. The constraint solver reasons about satisfiability of conjunctions of constraints, and the search engine controls the search for solutions by iteratively exploring a disjunctive search tree defined by the constraint program. In this paper we...
Conference Paper
We introduce the blame calculus , which adds the notion of blame from Findler and Felleisen's contracts to a system similar to Siek and Taha's gradual types and Flanagan's hybrid types . We characterise where positive and negative blame can arise by decomposing the usual notion of subtype into positive and negative subtypes, and show that these rec...
Conference Paper
Several recent language designs have oered a unified lan- guage for programming a distributed system, with explicit notation of locations; we call these "location-aware" lan- guages. 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 use...
Conference Paper
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 com- ponents, leading to a lack of compositionality. Using a semantics based on idioms, we show how to support compositional form construction and give a conv...
Article
Logic programming and functional programming row in the same boat. Meth-ods used to achieve success with one often transpose to the other, and both face similar obstacles. Here I offer a compendium of success stories for functional programs, followed by a list of obstacles to more widespread use of functional programming, in the belief that much of...
Conference Paper
Full-text available
This paper describes the history of Haskell, including its g enesis and principles, technical contributions, implementation s and tools, and applications and impact.
Article
Jean-Yves Girard and John Reynolds independently discovered the second-order polymorphic lambda calculus, F2. Girard additionally proved a Representation The- orem: every function on natural numbers that can be proved total in second-order intuitionistic predicate logic, P2, can be represented in F2. Reynolds additionally proved an Abstraction Theo...
Article
Full-text available
The world-wide web raises a variety of new programming challenges. To name a few: programming at the level of the web browser, data-centric approaches, and attempts to automatically discover and compose web services. This seminar brought together researchers from the web programming and web services communities and strove to engage them in communic...
Conference Paper
Full-text available
Abstract 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. Moreover, it is easy to implement, using simple desugaring rules.
Article
Full-text available
Participants in the seminar broke into groups on Patterns and Paradigms'' for web programming, Web Services,'' Data on the Web,'' Software Engineering'' and Security.'' Here we give the raw notes recorded during these sessions. @InProceedings{hull_et_al:DSP:2007:1127, author = {Richard Hull and Peter Thiemann and Philip Wadler}, title = {...
Article
Full-text available
From 28.01. to 02.02.2007, the Dagstuhl Seminar 07051 Programming Paradigms for the Web: Web Programming and Web Services'' was held in the International Conference and Research Center (IBFI), Schloss Dagstuhl. During the seminar, several participants presented their current research, and ongoing work and open problems were discussed. Abstracts o...
Chapter
Full-text available
This paper defines a set of type inference rules for resolving overloading introduced by type classes. Programs including type classes are transformed into ones which may be typed by the Hindley-Milner inference rules. In contrast to other work on type classes, the rules presented here relate directly to user programs. An innovative aspect of this...
Conference Paper
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 sup- ports rich clients running in what has been dubbed 'Ajax' style, and supports concurrent processes with statically-type...
Conference Paper
Faith and evolution provide complementary - and sometimes conflicting - models of the world, and they also can model the adoption of programming languages. Adherents of competing paradigms, such as functional and object-oriented programming, often appear motivated by faith. Families of related languages, such as C, C++, Java, and C#, may arise from...
Conference Paper
We consider the relation of the dual calculus of Wadler(2003) to the λμ-calculus of Parigot (1992). We give translations from the λμ-calculus into the dual calculus and back again. The translations form an equational correspondence as defined by Sabry and Felleisen (1993). In particular, translating from λμ to dual and then ‘reloading’ from dual ba...
Article
This paper introduces a new way of attaching proof terms to proof trees for classical linear logic, which bears a close resemblance to the way that pattern matching is used in programming languages. It equates the same proofs that are equated by proof nets, in the formulation of proof nets introduced by Dominic Hughes and Rob van Glabbeek; and goes...
Article
A number of useful optimisations are enabled if we can determine when a value is accessed at most once. We extend the Hindley-Milner type system with uses, yielding a typeinference based program analysis which determines when values are accessed at most once. Our analysis can handle higher-order functions and data structures, and admits principal t...
Article
This tutorial paper provides an introduction to intuitionistic logic and linear logic, and shows how they correspond to type systems for functional languages via the notion of `Propositions as Types'. The presentation of linear logic is simplified by basing it on the Logic of Unity.
Article
Girard described two translations of intuitionistic logic into linear logic, one where A ! B maps to (!A) Gammaffi B, and another where it maps to !(A Gammaffi B). We detail the action of these translations on terms, and show that the first corresponds to a callby -name calculus, while the second corresponds to call-by-value. We further show that i...
Article
Past attempts to apply Girard's linear logic have either had a clear relation to the theory (Lafont, Holmstrom, Abramsky) or a clear practical value (Guzm'an and Hudak, Wadler), but not both. This paper defines a sequence of languages based on linear logic that span the gap between theory and practice. Type reconstruction in a linear type system ca...
Conference Paper
The rules of classical logic may be formulated in pairs corresponding to De Morgan duals: rules about & are dual to rules about V. A line of work, including that of Filinski (1989), Griffin (1990), Parigot (1992), Danos, Joinet, and Schellinx (1995), Selinger (1998,2001), and Curien and Herbelin (2000), has led to the startling conclusion that call...
Article
Education matters. The lack of education on functional programming languages and techniques is visible on a daily basis. Our students, co-workers, friends, and colleagues just don't know enough about these ideas and therefore often fail to implement ...
Conference Paper
Full-text available
The World-Wide Web Consortium (W3C) promotes XML and related standards, including XML Schema, XQuery, and XPath. This paper describes a formalization of XML Schema. A formal semantics based on these ideas is part of the official XQuery and XPath specification, one of the first uses of formal methods by a standards body. XML Schema features both nam...
Conference Paper
The World-Wide Web Consortium (W3C) promotes XML and related standards, including XML Schema, XQuery, and XPath. This paper describes a formalization XML Schema. A formal semantics based on these ideas is part of the official XQuery and XPath specification, one of the first uses of formal methods by a standards body. XML Schema features both named...
Article
Full-text available
Model Schema Language (MSL) is an attempt to formalize some of the core ideas in XML Schema. The benefits of a formal description are that it is both concise and precise. MSL has already proved helpful in work on the design of XML Query. We expect that similar techniques can be used to extend MSL to include most or all XML Schema.
Article
if generics weren't available. The translation is designed so that new GJ code will work with existing Java libraries, even when the libraries are available only in binary class file form. GJ comes with a cast-iron guarantee: no cast inserted by the compiler will ever fail. (Caveat: this guarantee is void if the compiler generates an unchecked warn...
Article
The World-Wide Web Consortium (W3C) promotes XML and related standards, includingXM L Schema, XQuery, and XPath. This paper describes a formalization XML Schema. A formal semantics based on these ideas is part of the official XQuery and XPath specification, one of the first uses of formal methods by a standards body. XML Schema features both named...
Conference Paper
XQuery is a typed, functional language for querying XML, currently being designed by the XML Query Working Group of the World-Wide Web Consortium. Here are examples of XQuery queries on a suitable XML document describing books. To list titles of all books published before 2000 you might write: document(”books.xml”)/BOOKS/BOOK[@YEAR < 2000]/TITLE T...
Conference Paper
Full-text available
This document proposes an algebra for XML Query. The algebra has been submitted to the W3C XML Query Working Group. A novel feature of the algebra is the use of regular-expression types, similar in power to DTDs or XML Schemas, and closely related to Hasoya and Pierce’s work on Xduce. The iteration construct is based on the notion of a monad, and i...
Article
this article provides a tutorial introduction to these techniques. While little here will be new to the language theorist, some of what is here may be of use to the markup technologist. A formal semantics brings to light issues that can be hard to spot in an english language description. For instance, matching is a central concept in XSLT. Here is...
Article
A compositional style of programming is often advocated by functional programmers. However, there is a certain efficiency penalty involved in creating the requisite intermediate structures. Deforestation is a program transformation technique which removes such structures for some such programs. This paper is an investigation into the issues of term...
Article
ransformation. The key idea is that whenever an application of a function f may appear as the left argument of a concatenation, then we introduce a new function f 0 , satisfying the property () (f x 1 . . . x n ) ++ y = f 0 x 1 . . . x n y Author's address: Department of Computing Science, University of Glasgow, Glasgow G12 8QQ, Scotland. Electroni...
Article
The design of GJ (Bracha, Odersky, Stoutamire and Wadler), an extension of Java with parametric polymorphism, was significantly a#ected by the issue of compatibility between legacy Java code and new GJ code. In particular, the introduction of raw types made it easier to interface polymorphic code with monomorphic code. In GJ, for example, a polymor...
Conference Paper
Abstract Three decades past, the relational empire con - quered the hierarchical hegemony Today, an upstart challenges the relational empire's dominance, threatening the return of hierar - chy XML is Lisp's bastard nephew, with uglier syntax and no semantics Yet XML is poised to enable the creation of a web of data that dwarfs anything since the Li...
Conference Paper
some of the core idea in XML Schema. The benefits of a formal description is that it is both concise and precise. MSL has already proved helpful in work on the design of XML Query. We expect that similar techniques can be used to extend MSL to include most or all of XML Schema.
Article
Full-text available
. This document proposes an algebra for XML Query. The algebra has been submitted to the W3C XML Query Working Group. A novel feature of the algebra is the use of regular-expression types, similar in power to DTDs or XML Schemas, and closely related to Hasoya and Pierce's work on Xduce. The iteration construct is based on the notion of a monad, and...
Conference Paper
Full-text available
. This document proposes an algebra for XML Query. The algebra has been submitted to the W3C XML Query Working Group. A novel feature of the algebra is the use of regular-expression types, similar in power to DTDs or XML Schemas, and closely related to Hasoya, Pierce, and Vouillon's work on Xduce. The iteration construct involves novel typing rules...
Article
Deforestation is an automatic transformation scheme for functional programs which attempts to remove unnecessary intermediate data structures. The algorithm presented here is a variant of the original, adapted for a higher order language. A detailed description of how this may be implemented in an optimising compiler is also given.
Article
The second-order polymorphic lambda calculus (2) was independently discovered by Girard and Reynolds. Girard additionally proved a representation theorem: every function on natural numbers that can be proved total in second-order propositional logic (P2) can be represented in 2. Reynolds additionally proved an abstraction theorem: for a suitable no...
Article
Full-text available
Graph reduction underlies most implementations of lazy functional languages, allowing separate computations to share results when subterms are evaluated. Once a term is evaluated, the node of the graph representing the computation is updated with the value of the term. However, in many cases, no other computation requires this value, so the update...
Article
Full-text available
Gifford and others proposed an effect typing discipline to delimit the scope of computational effects within a program, while Moggi and others proposed monads for much the same purpose. Here we marry effects to monads, uniting two previously separate lines of research. In particular, we show that the type, region, and effect system of Talpin and Jo...
Article
Several recent studies have introduced lightweight versions of Java: reduced languages in which complex features like threads and reflection are dropped to enable rigorous arguments about key properties such as type safety. We carry this process a step further, omitting almost all features of the full language (including interfaces and even assignm...
Article
array :: (Ix a) =? (a,a) -? [(a,b)] -? Array a b listArray :: (Ix a) =? (a,a) -? [b] -? Array a b (!) :: (Ix a) =? Array a b -? a -? b bounds :: (Ix a) =?