Results 1  10
of
13
Type classes with functional dependencies
 ESOP/ETA (LNCS)
, 2000
"... Type classes in Haskell allow programmers to define functions that can be used on a set of different types, with a potentially different implementation in each case. For example, type classes are used to support equality and numeric types, and for monadic programming. A commonly requested extension ..."
Abstract

Cited by 153 (1 self)
 Add to MetaCart
Type classes in Haskell allow programmers to define functions that can be used on a set of different types, with a potentially different implementation in each case. For example, type classes are used to support equality and numeric types, and for monadic programming. A commonly requested extension to support ‘multiple parameters ’ allows a more general interpretation of classes as relations on types, and has many potentially useful applications. Unfortunately, many of these examples do not work well in practice, leading to ambiguities and inaccuracies in inferred types and delaying the detection of type errors. This paper illustrates the kind of problems that can occur with multiple parameter type classes, and explains how they can be resolved by allowing programmers to specify explicit dependencies between the parameters. A particular novelty of this paper is the application of ideas from the theory of relational databases to the design of type systems.
Coherence for Qualified Types
, 1993
"... The meaning of programs in a language with implicit overloading can be described by translating them into a second language that makes the use of overloading explicit. A single program may have many distinct translations and it is important to show that any two translations are semantically equivale ..."
Abstract

Cited by 89 (9 self)
 Add to MetaCart
The meaning of programs in a language with implicit overloading can be described by translating them into a second language that makes the use of overloading explicit. A single program may have many distinct translations and it is important to show that any two translations are semantically equivalent to ensure that the meaning of the original program is welldefined. This property is commonly known as coherence. This paper deals with an implicitly typed language that includes support for parametric polymorphism and overloading based on a system of qualified types. Typical applications include Haskell type classes, extensible records and subtyping. In the general case, it is possible to find examples for which the coherence property does not hold. Extending the development of a type inference algorithm for this language to include the calculation of translations, we give a simple syntactic condition on the principal type scheme of a term that is sufficient to guarantee coherence for a large class of programs. One of the most interesting aspects of this work is the use of terms in the target language to provide a semantic interpretation for the ordering relation between types that is used to establish the existence of principal types. On a practical level, our results explain the importance of unambiguous type schemes in Haskell.
The implementation of the Gofer functional programming system
, 1994
"... The Gofer system is a functional programming environment for a small, Haskelllike language. Supporting a wide range of different machines, including home computers, the system is widely used, both for teaching and research. This report describes the main ideas and techniques used in the implementat ..."
Abstract

Cited by 55 (4 self)
 Add to MetaCart
The Gofer system is a functional programming environment for a small, Haskelllike language. Supporting a wide range of different machines, including home computers, the system is widely used, both for teaching and research. This report describes the main ideas and techniques used in the implementation of Gofer. This information will be particularly useful for work using Gofer as a platform to explore the use of new language features or primitives. It should also be of interest to those curious to see how the general techniques of functional programming language compilation are adapted to a simple, but practical, implementation.
Typing Haskell in Haskell
 Haskell Workshop
, 1999
"... Haskell benefits from a sophisticated type system, but implementors, programmers, and researchers suffer because it has no formal description. To remedy this shortcoming, we present a Haskell program that implements a Haskell typechecker, thus providing a mathematically rigorous specification in a n ..."
Abstract

Cited by 51 (2 self)
 Add to MetaCart
Haskell benefits from a sophisticated type system, but implementors, programmers, and researchers suffer because it has no formal description. To remedy this shortcoming, we present a Haskell program that implements a Haskell typechecker, thus providing a mathematically rigorous specification in a notation that is familiar to Haskell users. We expect this program to fill a serious gap in current descriptions of Haskell, both as a starting point for discussions about existing features of the type system, and as a platform from which to explore new proposals.
A Second Look at Overloading
, 1995
"... We study a minimal extension of the Hindley#Milner system that supports overloading and polymorphic records. We show that the type system is sound with respect to a standard untyped compositional semantics. We also show that every typable term in this system has a principal type and give an algorith ..."
Abstract

Cited by 41 (6 self)
 Add to MetaCart
We study a minimal extension of the Hindley#Milner system that supports overloading and polymorphic records. We show that the type system is sound with respect to a standard untyped compositional semantics. We also show that every typable term in this system has a principal type and give an algorithm to reconstruct that type. 1 Introduction Arithmetic, equality, showing a value as a string: three operations guaranteed to give a language designer nightmares. Usually they are dealt with by some form of overloading; but which form is best? Even if we limit our attention to languages based on the highly successful Hindley#Milner type system, we #nd many di#ering treatments of overloading. The same language may treat di#erent operators di#erently; di#erent languages may treat the same operator di#erently; and the same language may treat the same operator di#erently over time. For instance, in Miranda arithmetic is de#ned only on a single numeric type; equality is a polymorphic function ...
Type Checking Type Classes
 IN PROC. 20TH ACM SYMP. PRINCIPLES OF PROGRAMMING LANGUAGES
, 1993
"... We study the type inference problem for a system with type classes as in the functional programming language Haskell. Type classes are an extension of MLstyle polymorphism with overloading. We generalize Milner's work on polymorphism by introducing a separate context constraining the type variables ..."
Abstract

Cited by 31 (3 self)
 Add to MetaCart
We study the type inference problem for a system with type classes as in the functional programming language Haskell. Type classes are an extension of MLstyle polymorphism with overloading. We generalize Milner's work on polymorphism by introducing a separate context constraining the type variables in a typing judgement. This leads to simple type inference systems and algorithms which closely resemble those for ML. In particular we present a new unification algorithm which is an extension of syntactic unification with constraint solving. The existence of principal types follows from an analysis of this unification algorithm.
Type Classes with Existential Types
, 1995
"... We argue that the novel combination of type classes and existential types in a single language yields significant expressive power. We explore this combination in the context of higherorder functional languages with static typing, parametric polymorphism, algebraic data types, and HindleyMilner ty ..."
Abstract

Cited by 29 (0 self)
 Add to MetaCart
We argue that the novel combination of type classes and existential types in a single language yields significant expressive power. We explore this combination in the context of higherorder functional languages with static typing, parametric polymorphism, algebraic data types, and HindleyMilner type inference. Adding existential types to an existing functional language that already features type classes requires only a minor syntactic extension. We first demonstrate how to provide existential quantification over type classes by extending the syntax of algebraic data type definitions and give examples of possible uses. We then develop a type system and a type inference algorithm for the resulting language. Finally, we present a formal semantics by translation to an implicitlytyped secondorder lcalculus and show that the type system is semantically sound. Our extension has been implemented in the Chalmers Haskell B. system, and all examples from this paper have been developed using ...
Type Reconstruction for Type Classes
, 1995
"... We study the type inference problem for a system with type classes as in the functional programming language Haskell. Type classes are an extension of MLstyle polymorphism with overloading. We generalize Milner's work on polymorphism byintroducing a separate context constraining the type variables ..."
Abstract

Cited by 23 (8 self)
 Add to MetaCart
We study the type inference problem for a system with type classes as in the functional programming language Haskell. Type classes are an extension of MLstyle polymorphism with overloading. We generalize Milner's work on polymorphism byintroducing a separate context constraining the type variables in a typing judgement. This leads to simple type inference systems and algorithms which closely resemble those for ML. In particular we present a new unification algorithm which is an extension of syntactic unification with constraint solving. The existence of principal types follows from an analysis of this unification algorithm.
ML typing, explicit polymorphism and qualified types
 In TACS '94: Conference on theoretical aspects of computer software
, 1994
"... Abstract. The ML type system was originally introduced as a means of identifying a class of terms in a simple untyped language, often referred to as coreML, whose evaluation could be guaranteed not to “go wrong”. In subsequent work, the terms of coreML have also been viewed as a ‘convenient shorth ..."
Abstract

Cited by 10 (1 self)
 Add to MetaCart
Abstract. The ML type system was originally introduced as a means of identifying a class of terms in a simple untyped language, often referred to as coreML, whose evaluation could be guaranteed not to “go wrong”. In subsequent work, the terms of coreML have also been viewed as a ‘convenient shorthand ’ for programs in typed languages. Notable examples include studies of ML polymorphism and investigations of overloading, motivated by the use of type classes in Haskell. In this paper, we show how qualified types, originally developed to study type class overloading, can be used to explore the relationship between coreML programs and their translations in an explicitly typed language. Viewing these two distinct applications as instances of a single framework has obvious advantages; many of the results that have been established for one can also be applied to the other. We concentrate particularly on the issue of coherence, establishing sufficient conditions to guarantee that all possible translations of a given coreML term are equivalent. One of the key features of this work is the use of conversions, similar to Mitchell’s retyping functions, to provide an interpretation of the ordering between type schemes in the target language. 1
Exploring the Design Space for Typebased Implicit Parameterization
 Proceedings of Supercomputing '97
, 1999
"... A common task in programming is to arrange for data to be passed from the point where it first becomes available to the places where it is needed, which may be much further down the call hierarchy. One approach is to store the data in a global variable. Another alternative is to add extra parame ..."
Abstract

Cited by 9 (1 self)
 Add to MetaCart
A common task in programming is to arrange for data to be passed from the point where it first becomes available to the places where it is needed, which may be much further down the call hierarchy. One approach is to store the data in a global variable. Another alternative is to add extra parameters at each level to thread it from the point of supply to the point of use. Neither of these is particularly attractive: The former is inflexible, while the latter requires modification of the program text, adding auxiliary parameters to each function definition and call. This paper explores the design space for a third alternative, using types to direct the introduction and use of implicit parameters and so carry data from supply to use. This gives the flexibility of parameterization without the burden of adding parameters by hand. The most general point in the design space uses relations on types to support sophisticated forms of overloading, and includes several known systems ...