159,096 research outputs found
Extensible records in the System E Framework and a new approach to object-oriented type inference
University of Technology, Sydney. Faculty of Engineering and Information Technology.Extensible records were proposed by Wand as a foundation for studying object-oriented type inference. One of their key benefits is that they allow for an elegant encoding of object-oriented inheritance, where one class of objects may be defined as an extension of another class of objects. However, every system of type inference designed for extensible records to date has been developed in the Hindley/Milner-style, a consequence being that polymorphism in these systems is not first-class and analysis is not strictly compositional. We argue that both of these features are necessary to retain the modelling and engineering benefits of traditional object-oriented languages such as Java:
1. Object-oriented modelling depends on the treatment of objects as first-class citizens, and this demands a type inference system capable of handling first-class polymorphism.
2. Object-oriented engineering encourages the separate development of software modules, and this should be supported by the type inference system with compositional analysis.
Both of these features are present in a type system for the λ-calculus called System E, which supports first-class polymorphism via intersection types, and compositional type inference via expansion variables. However, research into System E has so far focused on refining and simplifying the formulation of expansion variables and exploring type inference algorithms with various properties. Meanwhile, the system has not yet been extended beyond the terms of the pure λ-calculus and it lacks many features that would be needed in a practical object-oriented language.
In this dissertation, we combine System E with Wand’s extensible records resulting in a new approach to type inference for extensible records that better preserves the modelling and engineering benefits of object orientation stated above. The resulting system, called System Evcr, is significant because previous type inference systems, both for extensible records in particular, and also for object orientation in general, have at best preserved only one or the other of these two benefits, but never both of them simultaneously. System Evcr also makes a significant contribution to the work on System E, since it demonstrates for the first time that the System E’s expansion variables can be adapted to analyse programs whose term language extends beyond the pure λ-calculus.
To demonstrate the potential use of System Evcr in object-oriented type inference, an implementation of our type inference algorithm was created and is shown to succeed on problem examples that previous systems either fail to analyse, or else fail to analyse compositionally
Answer Refinement Modification: Refinement Type System for Algebraic Effects and Handlers
Algebraic effects and handlers are a mechanism to structure programs with
computational effects in a modular way. They are recently gaining popularity
and being adopted in practical languages, such as OCaml. Meanwhile, there has
been substantial progress in program verification via refinement type systems.
However, thus far, there has not been a satisfactory refinement type system for
algebraic effects and handlers. In this paper, we fill the void by proposing a
novel refinement type system for algebraic effects and handlers. The
expressivity and usefulness of algebraic effects and handlers come from their
ability to manipulate delimited continuations, but delimited continuations also
complicate programs' control flow and make their verification harder. To
address the complexity, we introduce a novel concept that we call answer
refinement modification (ARM for short), which allows the refinement type
system to precisely track what effects occur and in what order when a program
is executed, and reflect the information as modifications to the refinements in
the types of delimited continuations. We formalize our type system that
supports ARM (as well as answer type modification) and prove its soundness.
Additionally, as a proof of concept, we have implemented a corresponding type
checking and inference algorithm for a subset of OCaml 5, and evaluated it on a
number of benchmark programs. The evaluation demonstrates that ARM is
conceptually simple and practically useful. Finally, a natural alternative to
directly reasoning about a program with delimited continuations is to apply a
continuation passing style (CPS) transformation that transforms the program to
a pure program. We investigate this alternative, and show that the approach is
indeed possible by proposing a novel CPS transformation for algebraic effects
and handlers that enjoys bidirectional (refinement-)type-preservation.Comment: 66 page
Inferring Algebraic Effects
We present a complete polymorphic effect inference algorithm for an ML-style
language with handlers of not only exceptions, but of any other algebraic
effect such as input & output, mutable references and many others. Our main aim
is to offer the programmer a useful insight into the effectful behaviour of
programs. Handlers help here by cutting down possible effects and the resulting
lengthy output that often plagues precise effect systems. Additionally, we
present a set of methods that further simplify the displayed types, some even
by deliberately hiding inferred information from the programmer
Patterns for computational effects arising from a monad or a comonad
This paper presents equational-based logics for proving first order
properties of programming languages involving effects. We propose two dual
inference system patterns that can be instanciated with monads or comonads in
order to be used for proving properties of different effects. The first pattern
provides inference rules which can be interpreted in the Kleisli category of a
monad and the coKleisli category of the associated comonad. In a dual way, the
second pattern provides inference rules which can be interpreted in the
coKleisli category of a comonad and the Kleisli category of the associated
monad. The logics combine a 3-tier effect system for terms consisting of pure
terms and two other kinds of effects called 'constructors/observers' and
'modifiers', and a 2-tier system for 'up-to-effects' and 'strong' equations.
Each pattern provides generic rules for dealing with any monad (respectively
comonad), and it can be extended with specific rules for each effect. The paper
presents two use cases: a language with exceptions (using the standard monadic
semantics), and a language with state (using the less standard comonadic
semantics). Finally, we prove that the obtained inference system for states is
Hilbert-Post complete
- …