Academia.edu no longer supports Internet Explorer.
To browse Academia.edu and the wider internet faster and more securely, please take a few seconds to upgrade your browser.
2003
Generic programming aims at making programming more effective by making it more general. Generic programs often embody non-traditional 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.
2003
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.
2003
1 Generic Haskell is an extension of Haskell that supports the construction of generic programs. This article describes generic programming in practice. It discusses three advanced generic programming applications: generic dictionaries, compressing XML documents, and the zipper. When describing and implementing these examples, we will encounter some advanced features of Generic Haskell, such as type-indexed data types, dependencies between and generic abstractions of generic functions, adjusting a generic function using a default case, and generic functions with a special case for a particular constructor.
2011
Abstract Generic Haskell is an extension of Haskell that supports datatype generic programming. The central idea of Generic Haskell is to interpret a type by a function, the so-called instance of a generic function at that type. Since types in Haskell include parametric types such as' list of', Generic Haskell represents types by terms of the simply-typed lambda calculus.
2003
Generic Haskell is an extension of Haskell that supports the construction of generic programs. These lecture notes discuss three advanced generic programming applications: generic dictionaries, compressing XML documents, and the zipper: a data structure used to represent a tree together with a subtree that is the focus of attention, where that focus may move left, right, up or down the tree.
2007
The last decade has seen a number of approaches to datatype-generic programming: PolyP, Functorial ML,'Scrap Your Boilerplate', Generic Haskell,'Generics for the Masses', and so on. The approaches vary in sophistication and target audience: some propose full-blown programming languages, some suggest libraries, some can be seen as categorical programming methods. In these lecture notes we compare the various approaches to datatype-generic programming in Haskell.
The more expressive a type system, the more type infor- mation has to be provided in a program. Having to provide a type is sometimes a pain, but lacking expressivity is often even worse. There is a continuous struggle between expressivity and (type-)verbosity. How- ever, even very expressive type systems allow type inference for parts of a program. Generic Haskell is an extension of Haskell that supports defin- ing generic functions. Generic Haskell assumes that the type of a generic function is explicitly specified. This is often no problem, but sometimes it is rather painful to have to specify a type - in particular for generic functions with many dependencies - and sometimes the specified type can be generalized. In this paper, we identify three type inference prob- lems specific to generic functions, and present (partial) solutions to each of them.
2005
for carefully editing and catching the many many times when I accidentally skipped over the important stuff. Thanks to Jaakko and Jeremiah for hours of stimulating discussions and arguments concerning separate compilation and concept-based overloading. Thanks to David Abrahams for countless hours spent debating the merits of one design over another while jogging through the hinterlands of Norway. Thanks to Alexander Stepanov and David Musser for getting all this started, and thank you for the encouragement over the years. Thanks to Matthew Austern, his book Generic Programming in the STL was both an inspiration and an invaluable reference. Thanks to Beman Dawes and everyone involved with the Boost libraries. The collective experience from Boost was vital in the creation of this thesis. Thanks to Vincent Cremet and Martin Odersky for answering questions about Scala and virtual types.
2012
In Haskell, there is a clear distinction between values, types, and kinds. Values are built with constructors, such as True, which we colour in blue; we do not colour numerals, characters, or strings: Just 3, (Right 'p' Left "abc"). Datatypes, type synonyms, type variables, indexed families, and type classes are coloured in orange: Bool, Show α ⇒ Show [ α ], type family PF α. Kinds and kind variables are coloured in green: , → , Constraint. For simplicity we do not colour the arrow operator, as it can appear at different levels. Agda code The distinction between values and types is less clear in Agda. Our convention is to use blue for constructors (e.g. refl), orange for identifiers of type Set (e.g. _≡_), and green for identifiers of type Set 1 or (for simplicity) higher (e.g. Set). 2.2.3 Isomorphisms We have mentioned that some types are equivalent to others without formally defining this equivalence. When we say two types are equivalent we mean that they are isomorphic. The concept of isomorphism can be succinctly summarised as an Agda record type:
2009
These lecture notes introduce libraries for datatype-generic programming in Haskell. We introduce three characteristic generic programming libraries: lightweight implementation of generics and dynamics, extensible and modular generics for the masses, and scrap your boilerplate. We show how to use them to use and write generic programs. In the case studies for the different libraries we introduce generic components of a medium-sized application which assists a student in solving mathematical exercises.
2005
The more expressive a type system, the more type information has to be provided in a program. Having to provide a type is sometimes a pain, but lacking expressivity is often even worse. There is a continuous struggle between expressivity and (type-) verbosity. However, even very expressive type systems allow type inference for parts of a program. Generic Haskell is an extension of Haskell that supports defining generic functions. Generic Haskell assumes that the type of a generic function is explicitly specified.
2003
Abstract Generic Haskell is an extension of Haskell that supports the construction of generic programs. During the development of several applications, such as an XML editor and compressor, we encountered a number of limitations with the existing (Classic) Generic Haskell language, as implemented by the current Generic Haskell compiler.
2006
Abstract A generic function is a function that is defined on the structure of data types: with a single definition, we obtain a function that works for many data types. In contrast, an ad-hoc polymorphic function requires a separate implementation for each data type. Previous work by Hinze on lightweight generic programming has introduced techniques that allow the definition of generic functions directly in Haskell.
2000
Abstract This paper describes a new approach to generic functional programming, which allows us to define functions generically for all datatypes expressible in Haskell. A generic function is one that is defined by induction on the structure of types. Typical examples include pretty printers, parsers, and comparison functions.
Generic Programming, 2003
Recently, generic programming becomes of a major interest in several programming paradigms. A recurrent idea to achieve genericity is to specify algorithms on their convenient data structure, and to allow these specifications to be instantiated onto a large number of neighboring data structures. Polytypic programming, shapely types and generic attribute grammars are generic programming methods related to this approach. A framework for generic programming is proposed to embed these methods. It consists in tools for automatic generation of morphisms between data structures, and for program composition. Thanks to this compositional approach, the complete specialization of generic programs could be advantageously delegated to a general and powerful mechanism of "symbolic composition", which performs deforestation and partial evaluation. 1 Introduction In several programming paradigms, generic programming is being emerging. Although this concept is not new, genericity currently...
ACM SIGPLAN …, 2009
Datatype-generic programming is defining functions that depend on the structure, or "shape", of datatypes. It has been around for more than 10 years, and a lot of progress has been made, in particular in the lazy functional programming language Haskell. There are more than 10 proposals for generic programming libraries or language extensions for Haskell. To compare and characterize the many generic programming libraries in a typed functional language, we introduce a set of criteria and develop a generic programming benchmark: a set of characteristic examples testing various facets of datatype-generic programming. We have implemented the benchmark for nine existing Haskell generic programming libraries and present the evaluation of the libraries. The comparison is useful for reaching a common standard for generic programming, but also for a programmer who has to choose a particular approach for datatype-generic programming.
2004
Abstract A generic function is a function that can be instantiated on many data types to obtain data type specific functionality. Examples of generic functions are the functions that can be derived in Haskell, such as show, read, and'=='. The recent years have seen a number of proposals that support the definition of generic functions. Some of the proposals define new languages, some define extensions to existing languages.