8,240 research outputs found
Type Classes for Lightweight Substructural Types
Linear and substructural types are powerful tools, but adding them to
standard functional programming languages often means introducing extra
annotations and typing machinery. We propose a lightweight substructural type
system design that recasts the structural rules of weakening and contraction as
type classes; we demonstrate this design in a prototype language, Clamp.
Clamp supports polymorphic substructural types as well as an expressive
system of mutable references. At the same time, it adds little additional
overhead to a standard Damas-Hindley-Milner type system enriched with type
classes. We have established type safety for the core model and implemented a
type checker with type inference in Haskell.Comment: In Proceedings LINEARITY 2014, arXiv:1502.0441
Compositional Explanation of Types and Algorithmic Debugging of Type Errors
The type systems of most typed functional programming languages are based on the Hindley-Milner type system. A practical problem with these type systems is that it is often hard to understand why a program is not type correct or a function does not have the intended type. We suggest that at the core of this problem is the difficulty of explaining why a given expression has a certain type. The type system is not defined compositionally. We propose to explain types using a variant of the Hindley-Milner type system that defines a compositional type explanation graph of principal typings. We describe how the programmer understands types by interactive navigation through the explanation graph. Furthermore, the explanation graph can be the foundation for algorithmic debugging of type errors, that is, semi-automatic localisation of the source of a type error without even having to understand the type inference steps. We implemented a prototype of a tool to explore the usefulness of the proposed methods
Type Inference for Bimorphic Recursion
This paper proposes bimorphic recursion, which is restricted polymorphic
recursion such that every recursive call in the body of a function definition
has the same type. Bimorphic recursion allows us to assign two different types
to a recursively defined function: one is for its recursive calls and the other
is for its calls outside its definition. Bimorphic recursion in this paper can
be nested. This paper shows bimorphic recursion has principal types and
decidable type inference. Hence bimorphic recursion gives us flexible typing
for recursion with decidable type inference. This paper also shows that its
typability becomes undecidable because of nesting of recursions when one
removes the instantiation property from the bimorphic recursion.Comment: In Proceedings GandALF 2011, arXiv:1106.081
Contextual equivalence in lambda-calculi extended with letrec and with a parametric polymorphic type system
This paper describes a method to treat contextual equivalence in polymorphically typed lambda-calculi, and also how to transfer equivalences from the untyped versions of lambda-calculi to their typed variant, where our specific calculus has letrec, recursive types and is nondeterministic. An addition of a type label to every subexpression is all that is needed, together with some natural constraints for the consistency of the type labels and well-scopedness of expressions. One result is that an elementary but typed notion of program transformation is obtained and that untyped contextual equivalences also hold in the typed calculus as long as the expressions are well-typed. In order to have a nice interaction between reduction and typing, some reduction rules have to be accompanied with a type modification by generalizing or instantiating types
Type systems for distributed programs: session communication
Distributed systems are everywhere around us and guaranteeing their correctness is of paramount importance. It is natural to expect that these systems interact and communicate among them to achieve a common task.
In this work, we develop techniques based on types and type systems for the verification of correctness, consistency and safety properties related to communication in complex distributed systems. We study advanced safety properties related to communication, like deadlock or lock freedom and progress. We study session types in the pi-calculus describing distributed systems and communication-centric computation. Most importantly, we de- fine an encoding of the session pi-calculus into the standard typed pi-calculus in order to understand the expressive power of these concurrent calculi. We show how to derive in the session pi-calculus basic properties, like type safety or complex ones, like progress, by exploiting this encoding
Polymorphic Types in ACL2
This paper describes a tool suite for the ACL2 programming language which
incorporates certain ideas from the Hindley-Milner paradigm of functional
programming (as exemplified in popular languages like ML and Haskell),
including a "typed" style of programming with the ability to define polymorphic
types. These ideas are introduced via macros into the language of ACL2, taking
advantage of ACL2's guard-checking mechanism to perform type checking on both
function definitions and theorems. Finally, we discuss how these macros were
used to implement features of Specware, a software specification and
implementation system.Comment: In Proceedings ACL2 2014, arXiv:1406.123
- âŚ