Results 1 - 10
of
55
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 138 (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.
A Comparative Study of Language Support for Generic Programming
, 2003
"... Many modern programming languages support basic generic programming, sufficient to implement type-safe polymorphic containers. Some languages have moved beyond this basic support to a broader, more powerful interpretation of generic programming, and their extensions have proven valuable in practice. ..."
Abstract
-
Cited by 69 (12 self)
- Add to MetaCart
Many modern programming languages support basic generic programming, sufficient to implement type-safe polymorphic containers. Some languages have moved beyond this basic support to a broader, more powerful interpretation of generic programming, and their extensions have proven valuable in practice. This paper reports on a comprehensive comparison of generics in six programming languages: C , Standard ML, Haskell, Eiffel, Java (with its proposed generics extension), and Generic C#. By implementing a substantial example in each of these languages, we identify eight language features that support this broader view of generic programming. We find these features are necessary to avoid awkward designs, poor maintainability, unnecessary run-time checks, and painfully verbose code. As languages increasingly support generics, it is important that language designers understand the features necessary to provide powerful generics and that their absence causes serious difficulties for programmers.
Strongly typed heterogeneous collections
- In Haskell ’04: Proceedings of the ACM SIGPLAN workshop on Haskell
, 2004
"... A heterogeneous collection is a datatype that is capable of storing data of different types, while providing operations for look-up, update, iteration, and others. There are various kinds of heterogeneous collections, differing in representation, invariants, and access operations. We describe HLIST ..."
Abstract
-
Cited by 41 (8 self)
- Add to MetaCart
A heterogeneous collection is a datatype that is capable of storing data of different types, while providing operations for look-up, update, iteration, and others. There are various kinds of heterogeneous collections, differing in representation, invariants, and access operations. We describe HLIST — a Haskell library for strongly typed heterogeneous collections including extensible records. We illustrate HLIST’s benefits in the context of type-safe database access in Haskell. The HLIST library relies on common extensions of Haskell 98. Our exploration raises interesting issues regarding Haskell’s type system, in particular, avoidance of overlapping instances, and reification of type equality and type unification.
A Generic Programming Extension for Haskell
- Utrecht University
, 1999
"... Many functions can be dened completely generically for all datatypes. Examples include pretty printers (eg show), parsers (eg read), data converters, equality and comparison functions, mapping functions, and so forth. This paper proposes a generic programming extension that enables the user to dene ..."
Abstract
-
Cited by 39 (5 self)
- Add to MetaCart
Many functions can be dened completely generically for all datatypes. Examples include pretty printers (eg show), parsers (eg read), data converters, equality and comparison functions, mapping functions, and so forth. This paper proposes a generic programming extension that enables the user to dene such functions in Haskell. In particular, the proposal aims at generalizing Haskell's deriving construct, which is commonly considered decient since instance declarations can only be derived for a few predened classes. Using generic denitions derived instances can be specied for arbitrary user-dened type classes and for classes that abstract over type constructors of rst-order kind. 1 Introduction Generic or polytypic programming aims at relieving the programmer from repeatedly writing functions of similar functionality for dierent datatypes. Typical examples for socalled generic functions include pretty printers (eg show), parsers (eg read), functions that convert data into a u...
A typed representation for HTML and XML documents in Haskell
- Journal of Functional Programming
, 2001
"... We define a family of embedded domain specific languages for generating HTML and XML documents in Haskell. To this end, we have designed and implemented a combinator library which provides the means to create and modify HTML/XML elements. The resulting HTML/XML code is guaranteed to be well-formed. ..."
Abstract
-
Cited by 37 (0 self)
- Add to MetaCart
We define a family of embedded domain specific languages for generating HTML and XML documents in Haskell. To this end, we have designed and implemented a combinator library which provides the means to create and modify HTML/XML elements. The resulting HTML/XML code is guaranteed to be well-formed. In addition, the library can guarantee that the generated documents are valid XML documents (for HTML only a weaker guarantee is possible). Haskell can then be used as a meta language to define parameterized documents, to map structured documents to HTML/XML, to define conditional content, to extract information from the documents, or to define entire web sites. The combinators support a programing convention called container-passing style. Programs written in this style have a visual appearance similar to HTML/XML source code, without modifying the syntax of Haskell.
Faking It: Simulating Dependent Types in Haskell
, 2001
"... Dependent types reflect the fact that validity of data is often a relative notion by allowing prior data to affect the types of subsequent data. Not only does this make for a precise type system, but also a highly generic one: both the type and the program for each instance of a family of operations ..."
Abstract
-
Cited by 25 (5 self)
- Add to MetaCart
Dependent types reflect the fact that validity of data is often a relative notion by allowing prior data to affect the types of subsequent data. Not only does this make for a precise type system, but also a highly generic one: both the type and the program for each instance of a family of operations can be computed from the data which codes for that instance. Recent experimental extensions to the Haskell type class mechanism give us strong tools to relativize types to other types. We may simulate some aspects of dependent typing by making counterfeit type-level copies of data, with type constructors simulating data constructors and type classes simulating datatypes. This paper gives examples of the technique and discusses its potential. 1
The Heterogeneous Tool Set
- of Lecture Notes in Computer Science
, 2007
"... Abstract. Heterogeneous specification becomes more and more important because complex systems are often specified using multiple viewpoints, involving multiple formalisms. Moreover, a formal software development process may lead to a change of formalism during the development. However, current resea ..."
Abstract
-
Cited by 25 (17 self)
- Add to MetaCart
Abstract. Heterogeneous specification becomes more and more important because complex systems are often specified using multiple viewpoints, involving multiple formalisms. Moreover, a formal software development process may lead to a change of formalism during the development. However, current research in integrated formal methods only deals with ad-hoc integrations of different formalisms. The heterogeneous tool set (Hets) is a parsing, static analysis and proof management tool combining various such tools for individual specification languages, thus providing a tool for heterogeneous multi-logic specification. Hets is based on a graph of logics and languages (formalized as so-called institutions), their tools, and their translations. This provides a clean semantics of heterogeneous specification, as well as a corresponding proof calculus. For proof management, the calculus of development graphs (known from other large-scale proof management systems) has been adapted to heterogeneous specification. Development graphs provide an overview of the (heterogeneous) specification module hierarchy and the current proof state, and thus may be used for monitoring the overall correctness of a heterogeneous development. 1
A framework for extended algebraic data types
- In Proc. of FLOPS’06, volume 3945 of LNCS
, 2006
"... Abstract. There are a number of extended forms of algebraic data types such as type classes with existential types and generalized algebraic data types. Such extensions are highly useful but their interaction has not been studied formally so far. Here, we present a unifying framework for these exten ..."
Abstract
-
Cited by 22 (9 self)
- Add to MetaCart
Abstract. There are a number of extended forms of algebraic data types such as type classes with existential types and generalized algebraic data types. Such extensions are highly useful but their interaction has not been studied formally so far. Here, we present a unifying framework for these extensions. We show that the combination of type classes and generalized algebraic data types allows us to express a number of interesting properties which are desired by programmers. We support type checking based on a novel constraint solver. Our results show that our system is practical and greatly extends the expressive power of languages such as Haskell and ML. 1
The Design and Implementation of Mondrian
- In Proceedings of the Haskell Workshop
, 1997
"... The Haskell dialect Mondrian is designed using the explicit philosophy of keeping things simple and consistent. Mondrian generalizes some of Haskell's (too) complex constructs, and adds a few simple new ones. This results in a small, intuitively comprehensible language with an object oriented flavor ..."
Abstract
-
Cited by 19 (4 self)
- Add to MetaCart
The Haskell dialect Mondrian is designed using the explicit philosophy of keeping things simple and consistent. Mondrian generalizes some of Haskell's (too) complex constructs, and adds a few simple new ones. This results in a small, intuitively comprehensible language with an object oriented flavor. In this paper, we will present the design decisions we made for Mondrian. Furthermore, some of Mondrian's language constructs will be defined by translations into Haskell. 1 Introduction In the preface of the Haskell report [13] the hope is expressed that extensions or variants of the language will appear that incorporate experimental features. The language Mondrian is such an experiment. Mondrian evolved from Haskell by deleting and combining some of Haskell's more complicated constructs and adding a few simple new ones. Unlike the language Pizza [29], which is designed as a strict superset of Java [8], the major concern in designing Mondrian has been to keep the language as basic and do...

