Results 1  10
of
91
Firstclass phantom types
, 2003
"... Classical phantom types are datatypes in which type constraints are expressed using type variables that do not appear in the datatype cases themselves. They can be used to embed typed languages into Haskell or ML. However, while such encodings guarantee that only wellformed data can be constructed, ..."
Abstract

Cited by 114 (2 self)
 Add to MetaCart
Classical phantom types are datatypes in which type constraints are expressed using type variables that do not appear in the datatype cases themselves. They can be used to embed typed languages into Haskell or ML. However, while such encodings guarantee that only wellformed data can be constructed, they do not permit typesafe deconstruction without additional tagging and runtime checks. We introduce firstclass phantom types, which make such constraints explicit via type equations. Examples of firstclass phantom types include typed type representations and typed higherorder abstract syntax trees. These types can be used to support typed generic functions, dynamic typing, and staged compilation in higherorder, statically typed languages such as Haskell or Standard ML. In our system, type constraints can be equations between type constructors as well as type functions of higherorder kinds. We prove type soundness and decidability for a Haskelllike language extended by firstclass phantom types. 1
Polytypic Values Possess Polykinded Types
, 2000
"... A polytypic value is one that is defined by induction on the structure of types. In Haskell the type structure is described by the socalled kind system, which distinguishes between manifest types like the type of integers and functions on types like the list type constructor. Previous approaches to ..."
Abstract

Cited by 109 (19 self)
 Add to MetaCart
(Show Context)
A polytypic value is one that is defined by induction on the structure of types. In Haskell the type structure is described by the socalled kind system, which distinguishes between manifest types like the type of integers and functions on types like the list type constructor. Previous approaches to polytypic programming were restricted in that they only allowed to parameterize values by types of one fixed kind. In this paper we show how to define values that are indexed by types of arbitrary kinds. It appears that these polytypic values possess types that are indexed by kinds. We present several examples that demonstrate that the additional exibility is useful in practice. One paradigmatic example is the mapping function, which describes the functorial action on arrows. A single polytypic definition yields mapping functions for datatypes of arbitrary kinds including first and higherorder functors. Polytypic values enjoy polytypic properties. Using kindindexed logical relations we prove...
Monadic Presentations of Lambda Terms Using Generalized Inductive Types
 In Computer Science Logic
, 1999
"... . We present a denition of untyped terms using a heterogeneous datatype, i.e. an inductively dened operator. This operator can be extended to a Kleisli triple, which is a concise way to verify the substitution laws for calculus. We also observe that repetitions in the denition of the monad as wel ..."
Abstract

Cited by 95 (18 self)
 Add to MetaCart
(Show Context)
. We present a denition of untyped terms using a heterogeneous datatype, i.e. an inductively dened operator. This operator can be extended to a Kleisli triple, which is a concise way to verify the substitution laws for calculus. We also observe that repetitions in the denition of the monad as well as in the proofs can be avoided by using wellfounded recursion and induction instead of structural induction. We extend the construction to the simply typed calculus using dependent types, and show that this is an instance of a generalization of Kleisli triples. The proofs for the untyped case have been checked using the LEGO system. Keywords. Type Theory, inductive types, calculus, category theory. 1 Introduction The metatheory of substitution for calculi is interesting maybe because it seems intuitively obvious but becomes quite intricate if we take a closer look. [Hue92] states seven formal properties of substitution which are then used to prove a general substitution theor...
De Bruijn notation as a nested datatype
 Journal of Functional Programming
, 1999
"... “I have no data yet. It is a capital mistake to theorise before one has data.” ..."
Abstract

Cited by 78 (3 self)
 Add to MetaCart
(Show Context)
“I have no data yet. It is a capital mistake to theorise before one has data.”
A Lightweight Implementation of Generics and Dynamics
, 2002
"... The recent years have seen a number of proposals for extending statically typed languages by dynamics or generics. Most proposals  if not all  require significant extensions to the underlying language. In this paper we show that this need not be the case. We propose a particularly lightweight ..."
Abstract

Cited by 77 (5 self)
 Add to MetaCart
(Show Context)
The recent years have seen a number of proposals for extending statically typed languages by dynamics or generics. Most proposals  if not all  require significant extensions to the underlying language. In this paper we show that this need not be the case. We propose a particularly lightweight extension that supports both dynamics and generics. Furthermore, the two features are smoothly integrated: dynamic values, for instance, can be passed to generic functions. Our proposal makes do with a standard HindleyMilner type system augmented by existential types. Building upon these ideas we have implemented a small library that is readily usable both with Hugs and with the Glasgow Haskell compiler.
Generic Haskell: practice and theory
 In Generic Programming, Advanced Lectures, volume 2793 of LNCS
, 2003
"... Abstract. Generic Haskell is an extension of Haskell that supports the construction of generic programs. These lecture notes describe the basic constructs of Generic Haskell and highlight the underlying theory. Generic programming aims at making programming more effective by making it more general. ..."
Abstract

Cited by 72 (23 self)
 Add to MetaCart
(Show Context)
Abstract. Generic Haskell is an extension of Haskell that supports the construction of generic programs. These lecture notes describe the basic constructs of Generic Haskell and highlight the underlying theory. Generic programming aims at making programming more effective by making it more general. Generic programs often embody nontraditional kinds of polymorphism. Generic Haskell is an extension of Haskell [38] that supports the construction of generic programs. Generic Haskell adds to Haskell the notion of structural polymorphism, the ability to define a function (or a type) by induction on the structure of types. Such a function is generic in the sense that it works not only for a specific type but for a whole class of types. Typical examples include equality, parsing and pretty printing, serialising, ordering, hashing, and so on. The lecture notes on Generic Haskell are organized into two parts. This first part motivates the need for genericity, describes the basic constructs of Generic Haskell, puts Generic Haskell into perspective, and highlights the underlying theory. The second part entitled “Generic Haskell: applications ” delves deeper into the language discussing three nontrivial applications of Generic Haskell: generic dictionaries, compressing XML documents, and a generic version of the zipper data type. The first part is organized as follows. Section 1 provides some background discussing type systems in general and the type system of Haskell in particular. Furthermore, it motivates the basic constructs of Generic Haskell. Section 2 takes a closer look at generic definitions and shows how to define some popular generic functions. Section 3 highlights the theory underlying Generic Haskell and discusses its implementation. Section 4 concludes. 1
Generalised Folds for Nested Datatypes
 Formal Aspects of Computing
, 1999
"... Nested datatypes generalise regular datatypes in much the same way that contextfree languages generalise regular ones. Although the categorical semantics of nested types turns out to be similar to the regular case, the fold functions are more limited because they can only describe natural transform ..."
Abstract

Cited by 44 (1 self)
 Add to MetaCart
(Show Context)
Nested datatypes generalise regular datatypes in much the same way that contextfree languages generalise regular ones. Although the categorical semantics of nested types turns out to be similar to the regular case, the fold functions are more limited because they can only describe natural transformations. Practical considerations therefore dictate the introduction of a generalised fold function in which this limitation can be overcome. In the paper we show how to construct generalised folds systematically for each nested datatype, and show that they possess a uniqueness property analogous to that of ordinary folds. As a consequence, generalised folds satisfy fusion properties similar to those developed for regular datatypes. Such properties form the core of an effective calculational theory of inductive datatypes.
The next 700 data description languages
 In ACM SIGPLANSIGACT Symposium on Principles of Programming Languages
, 2006
"... governmental, scientific, and private data. Because they have been standardized and are widely used, many reliable, efficient, and convenient tools for processing data in these formats are readily available. For instance, your favorite programming language undoubtedly has libraries for parsing XML a ..."
Abstract

Cited by 44 (11 self)
 Add to MetaCart
governmental, scientific, and private data. Because they have been standardized and are widely used, many reliable, efficient, and convenient tools for processing data in these formats are readily available. For instance, your favorite programming language undoubtedly has libraries for parsing XML and HTML as well as reading and transforming images in JPEG or movies in MPEG. Query engines are available for querying XML documents. Widelyused applications like Microsoft Word and Excel automatically translate documents between HTML and other standard formats. In short, life is good when working with standard data formats. In an ideal world, all data would be in such formats. In reality, however, we are not nearly so fortunate. An ad hoc data format is any nonstandard data format. Typically, such formats do not have parsing, querying, analysis, or transformation tools readily available. Every day, network administrators, financial analysts, computer scientists, biologists, chemists, astronomers, and physicists deal with ad hoc data in a myriad of complex formats. Figure 1 gives a partial sense of the range and pervasiveness of such data. Since offtheshelf tools for processing these ad hoc data formats do not exist or are not readily available, talented scientists, data analysts, and programmers must waste their time on lowlevel chores like parsing and format translation to extract the valuable information they need from their data.
The derivative of a regular type is its type of onehole contexts (extended abstract), 2001. Unpublished manuscript, available via http://strictlypositive.org/diff.pdf. Conor McBride and Ross Paterson. Applicative programming with effects
"... Polymorphic regular types are treelike datatypes generated by polynomial type expressions over a set of free variables and closed under least fixed point. The ‘equality types ’ of Core ML can be expressed in this form. Given such a type expression with free, this paper shows a way to represent the ..."
Abstract

Cited by 42 (8 self)
 Add to MetaCart
Polymorphic regular types are treelike datatypes generated by polynomial type expressions over a set of free variables and closed under least fixed point. The ‘equality types ’ of Core ML can be expressed in this form. Given such a type expression with free, this paper shows a way to represent the onehole contexts for elements of within elements of, together with an operation which will plug an element of into the hole of such a context. Onehole contexts are given as inhabitants of a regular type, computed generically from the syntactic structure of by a mechanism better known as partial differentiation. The relevant notion of containment is shown to be appropriately characterized in terms of derivatives and plugging in. The technology is then exploited to give the onehole contexts for subelements of recursive types in a manner similar to Huet’s ‘zippers’[Hue97]. 1