Results 1 - 10
of
11
Associated Types with Class
- In POPL ’05: Proceedings of the 32nd ACM SIGPLAN-SIGACT symposium on Principles of programming languages
, 2005
"... In this paper, we explore an extension to Haskell type classes that allows a type class declaration to define data types as well as values (or methods). Similarly, an instance declaration gives a witness for such data types, as well as a witness for each method. It turns out that this extension dire ..."
Abstract
-
Cited by 63 (18 self)
- Add to MetaCart
In this paper, we explore an extension to Haskell type classes that allows a type class declaration to define data types as well as values (or methods). Similarly, an instance declaration gives a witness for such data types, as well as a witness for each method. It turns out that this extension directly supports the idea of a type-indexed type, and is useful in many applications, especially for self-optimising libraries that adapt their data representations and algorithms in a type-directed manner.
A theory of overloading
- ACM Transactions on Programming Languages and Systems (TOPLAS
, 2002
"... Abstract We introduce a novel approach for debugging ill-typed programs in the Hindley/Milner system. We map the typing problem for a program to a system of constraints each attached to program code that generates the constraints. We use reasoning about constraint satisfiability and implication to f ..."
Abstract
-
Cited by 52 (17 self)
- Add to MetaCart
Abstract We introduce a novel approach for debugging ill-typed programs in the Hindley/Milner system. We map the typing problem for a program to a system of constraints each attached to program code that generates the constraints. We use reasoning about constraint satisfiability and implication to find minimal justifications of type errors, and to explain unexpected types that arise. Through an interactive process akin to declarative debugging, a user can track down exactly where a type error occurs. We are able to capture various extensions of the Hindley/Milner system such as type annotations and Haskell-style type class overloading. The approach has been implemented as part of the Chameleon system.
Datatype-generic programming
- Spring School on Datatype-Generic Programming, volume 4719 of Lecture Notes in Computer Science
"... Abstract. Generic programming aims to increase the flexibility of programming languages, by expanding the possibilities for parametrization — ideally, without also expanding the possibilities for uncaught errors. The term means different things to different people: parametric polymorphism, data abst ..."
Abstract
-
Cited by 34 (11 self)
- Add to MetaCart
Abstract. Generic programming aims to increase the flexibility of programming languages, by expanding the possibilities for parametrization — ideally, without also expanding the possibilities for uncaught errors. The term means different things to different people: parametric polymorphism, data abstraction, meta-programming, and so on. We use it to mean polytypism, that is, parametrization by the shape of data structures rather than their contents. To avoid confusion with other uses, we have coined the qualified term datatype-generic programming for this purpose. In these lecture notes, we expand on the definition of datatype-generic programming, and present some examples of datatypegeneric programs. We also explore the connection with design patterns in object-oriented programming; in particular, we argue that certain design patterns are just higher-order datatype-generic programs. 1
Type Checking with Open Type Functions
"... We report on an extension of Haskell with open type-level functions and equality constraints that unifies earlier work on GADTs, functional dependencies, and associated types. The contribution of the paper is that we identify and characterise the key technical challenge of entailment checking; and w ..."
Abstract
-
Cited by 28 (14 self)
- Add to MetaCart
We report on an extension of Haskell with open type-level functions and equality constraints that unifies earlier work on GADTs, functional dependencies, and associated types. The contribution of the paper is that we identify and characterise the key technical challenge of entailment checking; and we give a novel, decidable, sound, and complete algorithm to solve it, together with some practically-important variants. Our system is implemented in GHC, and is already in active use.
Improving the Static Analysis of Embedded Languages via Partial Evaluation
, 2004
"... detected or enforced by their host language. We show how to use macros to easily implement partial evaluation of embedded interpreters in order to capture invariants encoded in embedded programs and render them explicit in the terms of their host language. We demonstrate the effectiveness of this te ..."
Abstract
-
Cited by 8 (0 self)
- Add to MetaCart
detected or enforced by their host language. We show how to use macros to easily implement partial evaluation of embedded interpreters in order to capture invariants encoded in embedded programs and render them explicit in the terms of their host language. We demonstrate the effectiveness of this technique in improving the results of a value flow analysis.
Programmable Type Systems for Domain Specific Languages
, 2002
"... A language with a programmable type system is vital for the construction of an embedded domain specific language (EDSL). Driven by the requirements posed by the implementation of an EDSL for server-side Web scripting, we examine two major of extensions to the type system of the host language, Haskel ..."
Abstract
-
Cited by 7 (1 self)
- Add to MetaCart
A language with a programmable type system is vital for the construction of an embedded domain specific language (EDSL). Driven by the requirements posed by the implementation of an EDSL for server-side Web scripting, we examine two major of extensions to the type system of the host language, Haskell. We show that a component that ensures the generation of correct HTML documents can take good advantage of type-level functions, as implemented using functional logic overloading. We further show that a function that ensures the consistency of data submitted to a Web script with the data expected by the script is less awkward to use in the presence of lambda expressions in the type language. In both cases we assess the guarantees obtained by the use of the typing and explore alternative solutions.
Beyond Type Classes
, 2002
"... We discuss type classes in the context of the Chameleon language, a Haskell-style language where overloading resolution is expressed in terms of the meta-language of Constraint Handling Rules (CHRs). In a first step, we show how to encode Haskell's single-parameter type classes into Chameleon. The e ..."
Abstract
- Add to MetaCart
We discuss type classes in the context of the Chameleon language, a Haskell-style language where overloading resolution is expressed in terms of the meta-language of Constraint Handling Rules (CHRs). In a first step, we show how to encode Haskell's single-parameter type classes into Chameleon. The encoding works by providing an approrpriate set of CHRs which mimic the Haskell conditions. We also consider constructor classes, multi-parameter type classes and functional dependencies. Chameleon provides a testbed to experiment with new overloading features. We show how some novel features such as universal quantification in context can naturally be expressed in Chameleon.
Under consideration for publication in J. Functional Programming 1 FUNCT I ONAL PEARL
"... Introduction When I was a student, Simula was one of the languages taught in introductory programming language courses and I vividly remember a sticker one of our instructors had attached to the door of his oce, saying \Simula does it with class". I guess the same holds for Haskell except that Hask ..."
Abstract
- Add to MetaCart
Introduction When I was a student, Simula was one of the languages taught in introductory programming language courses and I vividly remember a sticker one of our instructors had attached to the door of his oce, saying \Simula does it with class". I guess the same holds for Haskell except that Haskell replaces classes by type classes. Armed with singleton types, multiple-parameter type classes, and functional dependencies we reconsider a problem raised and solved by Danvy in a previous pearl (1998). The challenge is to implement a variant of C's printf function, called format below, in a statically typed language. Here is an interactive session that illustrates the problem: Maini :type format (lit "hello world") String Maini format (lit "hello world") "hello world" Maini :type format int Int ! String Maini format int 5 "5" Maini :type format (int ^ lit " is " ^ str) Int ! String ! String Maini format (int ^ lit " is " ^ str) 5 "five" "5 is five": The format directive lit
Type Structure General Terms Algorithms, Languages
"... Type Checking with Open Type Functions We report on an extension of Haskell with open type-level functions and equality constraints that unifies earlier work on GADTs, functional dependencies, and associated types. The contribution of the paper is that we identify and characterise the key technical ..."
Abstract
- Add to MetaCart
Type Checking with Open Type Functions We report on an extension of Haskell with open type-level functions and equality constraints that unifies earlier work on GADTs, functional dependencies, and associated types. The contribution of the paper is that we identify and characterise the key technical challenge of entailment checking; and we give a novel, decidable, sound, and complete algorithm to solve it, together with some practically-important variants. Our system is implemented in GHC, and is already in active use.
General Terms Reliability, Languages
"... Programs in embedded languages contain invariants that are not automatically detected or enforced by their host language. We show how to use macros to easily implement partial evaluation of embedded interpreters in order to capture invariants encoded in embedded programs and render them explicit in ..."
Abstract
- Add to MetaCart
Programs in embedded languages contain invariants that are not automatically detected or enforced by their host language. We show how to use macros to easily implement partial evaluation of embedded interpreters in order to capture invariants encoded in embedded programs and render them explicit in the terms of their host language. We demonstrate the effectiveness of this technique in improving the results of a value flow analysis. Categories and Subject Descriptors

