157,787 research outputs found
Type inference with constrained types
In this paper we present a general framework HM(X) for
Hindley/Milner style type systems with constraints, analogous
to the CLP(X) framework in constrained logic programming.
We present sufficient conditions on the constraint domain X
so that the principal types property carries over to HM(X).
The conditions turn out to be fairly simple and natural.
The usage of the aproach is demonstrated in instantion
of parameter X with several known type disciplines.
We consider extensible records, typeclasses, overloading
and subtyping
A type system for context-dependent overloading.
This article presents a type system for context-dependent overloading, based on the notion of constrained types. These are types constrained by the definition of functions or constants of given types. This notion supports both overloading and a form of subtyping, and is related to Haskell type classes [11,2], System O [7] and other systems with constrained types. We study an extension of the Damas-Milner system [4,1] with constrained types. The inference system presented uses a context-dependent overloading policy, which is specified by means of a predicate used in a single inference rule. The idea simplifies the treatment of overloading, enables the simplification of inferred types (by means of class type annotations), and is adequate for use in a type system with higher-order types
Complete Bidirectional Typing for the Calculus of Inductive Constructions
This article presents a bidirectional type system for the Calculus of Inductive Constructions (CIC). The key property of the system is its completeness with respect to the usual undirected one, which has been formally proven in Coq as a part of the MetaCoq project. Although it plays an important role in an ongoing completeness proof for a realistic typing algorithm, the interest of bidirectionality is wider, as it gives insights and structure when trying to prove properties on CIC or design variations and extensions. In particular, we put forward constrained inference, an intermediate between the usual inference and checking judgements, to handle the presence of computation in types
Kindly Bent to Free Us
Systems programming often requires the manipulation of resources like file
handles, network connections, or dynamically allocated memory. Programmers need
to follow certain protocols to handle these resources correctly. Violating
these protocols causes bugs ranging from type mismatches over data races to
use-after-free errors and memory leaks. These bugs often lead to security
vulnerabilities.
While statically typed programming languages guarantee type soundness and
memory safety by design, most of them do not address issues arising from
improper handling of resources. An important step towards handling resources is
the adoption of linear and affine types that enforce single-threaded resource
usage. However, the few languages supporting such types require heavy type
annotations.
We present Affe, an extension of ML that manages linearity and affinity
properties using kinds and constrained types. In addition Affe supports the
exclusive and shared borrowing of affine resources, inspired by features of
Rust. Moreover, Affe retains the defining features of the ML family: it is an
impure, strict, functional expression language with complete principal type
inference and type abstraction. Affe does not require any linearity annotations
in expressions and supports common functional programming idioms.Comment: ICFP 202
Why languages differ : variation in the conventionalization of constraints on inference
Sperber and Wilson (1996) and Wilson and Sperber (1993) have argued that communication involves two processes, ostension and inference, but they also assume there is a coding-decoding stage of communication and a functional distinction between lexical items and grammatical marking (what they call 'conceptual' vs. 'procedural' information). Sperber and Wilson have accepted a basically Chomskyan view of the innateness of language structure and Universal Grammar
Using parametric set constraints for locating errors in CLP programs
This paper introduces a framework of parametric descriptive directional types
for constraint logic programming (CLP). It proposes a method for locating type
errors in CLP programs and presents a prototype debugging tool. The main
technique used is checking correctness of programs w.r.t. type specifications.
The approach is based on a generalization of known methods for proving
correctness of logic programs to the case of parametric specifications.
Set-constraint techniques are used for formulating and checking verification
conditions for (parametric) polymorphic type specifications. The specifications
are expressed in a parametric extension of the formalism of term grammars. The
soundness of the method is proved and the prototype debugging tool supporting
the proposed approach is illustrated on examples.
The paper is a substantial extension of the previous work by the same authors
concerning monomorphic directional types.Comment: 64 pages, To appear in Theory and Practice of Logic Programmin
- …