Deriving a Relationship from a Single Example (original) (raw)

A generic deriving mechanism for Haskell

2010

Abstract Haskell's deriving mechanism supports the automatic generation of instances for a number of functions. The Haskell 98 Report only specifies how to generate instances for the Eq, Ord, Enum, Bounded, Show, and Read classes. The description of how to generate instances is largely informal. The generation of instances imposes restrictions on the shape of datatypes, depending on the particular class to derive. As a consequence, the portability of instances across different compilers is not guaranteed.

Types Inference for Generic 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.

Chapter 1. Generic Haskell: Practice and Theory

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.

Type inference for generic Haskell

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.

Comparing approaches to generic programming in Haskell

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.

Generic Haskell: Applications

Advanced Courses, 2003

Generic Haskell is an extension of Haskell that supports the construc- tion 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

Chapter 2. Generic Haskell: Applications

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.