Results 1  10
of
24
Comparing Libraries for Generic Programming in Haskell
, 2008
"... Datatypegeneric 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 p ..."
Abstract

Cited by 24 (9 self)
 Add to MetaCart
Datatypegeneric 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 datatypegeneric 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 datatypegeneric programming.
Adapting Mathematical Domain Reasoners
, 2010
"... Mathematical learning environments help students in mastering mathematical knowledge. Mature environments typically offer thousands of interactive exercises. Providing feedback to students solving interactive exercises requires domain reasoners for doing the exercisespecific calculations. Since a ..."
Abstract

Cited by 5 (5 self)
 Add to MetaCart
(Show Context)
Mathematical learning environments help students in mastering mathematical knowledge. Mature environments typically offer thousands of interactive exercises. Providing feedback to students solving interactive exercises requires domain reasoners for doing the exercisespecific calculations. Since a domain reasoner has to solve an exercise in the same way a student should solve it, the structure of domain reasoners should follow the layered structure of the mathematical domains. Furthermore, learners, teachers, and environment builders have different requirements for adapting domain reasoners, such as providing more details, disallowing or enforcing certain solutions, and combining multiple mathematical domains in a new domain. In previous work we have shown how domain reasoners for solving interactive exercises can be expressed in terms of rewrite strategies, rewrite rules, and views. This paper shows how users can adapt and configure such domain reasoners to their own needs. This is achieved by enabling users to explicitly communicate the components that are used for solving an exercise.
The right kind of generic programming
 In Proceedings of the 8th ACM SIGPLAN Workshop on Generic Programming, WGP ’12
, 2012
"... Haskell is known for its strong, static type system. A good type system classifies values, constraining the valid terms of the language and preventing many common programming errors. The Glasgow Haskell Compiler (GHC) has further extended the type language of Haskell, adding support for typelevel c ..."
Abstract

Cited by 5 (1 self)
 Add to MetaCart
Haskell is known for its strong, static type system. A good type system classifies values, constraining the valid terms of the language and preventing many common programming errors. The Glasgow Haskell Compiler (GHC) has further extended the type language of Haskell, adding support for typelevel computation and explicit type equality constraints. Typelevel programming is used to classify values, but types themselves have remained notoriously unclassified. Recently, however, the kindlevel language was extended with support for userdefined kinds and kind polymorphism. In this paper we revisit generic programming approaches that rely heavily on typelevel computation, and analyse how to improve them with the extended kind language. For instructive purposes, we list a series of advantages given by the new features, and also a number of shortcomings that prevent desirable use patterns.
Canonical Forms in Interactive Exercise Assistants
, 2009
"... Interactive exercise assistants support students in practicing exercises, and acquiring procedural skills. Many mathematical topics can be practiced in such assistants. Ideally, an interactive exercise assistant not only validates final answers, but also comments on intermediate steps submitted by ..."
Abstract

Cited by 4 (4 self)
 Add to MetaCart
(Show Context)
Interactive exercise assistants support students in practicing exercises, and acquiring procedural skills. Many mathematical topics can be practiced in such assistants. Ideally, an interactive exercise assistant not only validates final answers, but also comments on intermediate steps submitted by a student, provides hints on how to proceed, and presents workedout examples. For these purposes, fine control over the symbolic simplification procedures of the underlying mathematical machinery is needed. In this paper, we introduce views for mathematical expressions. A view defines an equivalence relation by choosing a canonical form of mathematical expressions. We use views to track and recognize intermediate answers, to help in presenting expressions to a user, and to control the granularity of the steps in workedout examples. We develop the concept of a view, discuss the laws it satisfies, and show how views are composed, which means that they can be used for multiple exercise classes. 1
Optimizing Generics Is Easy!
, 2009
"... Datatypegeneric programming increases program reliability by reducing code duplication and enhancing reusability and modularity. Several generic programming libraries for Haskell have been developed in the past few years. These libraries have been compared in detail with respect to expressiveness, ..."
Abstract

Cited by 3 (2 self)
 Add to MetaCart
Datatypegeneric programming increases program reliability by reducing code duplication and enhancing reusability and modularity. Several generic programming libraries for Haskell have been developed in the past few years. These libraries have been compared in detail with respect to expressiveness, extensibility, typing issues, etc., but performance comparisons have been brief, limited, and preliminary. It is widely believed that generic programs run slower than handwritten code. In this paper we present an extensive benchmarking suite for generic functions and analyze the potential for automatic code optimization at compilation time. Our benchmark confirms that generic programs, when compiled with the standard optimization flags of the Glasgow Haskell Compiler, are substantially slower than their handwritten counterparts. However, we also find that more advanced optimization capabilities of GHC can be used to further optimize generic functions, sometimes achieving the same efficiency as handwritten code.
Generic Programming with Indexed Functors
, 2011
"... Much has been said and done about generic programming approaches in stronglytyped functional languages such as Haskell and Agda. Different approaches use different techniques and are better or worse suited for certain uses, depending on design decisions such as generic view, universe size and compl ..."
Abstract

Cited by 2 (0 self)
 Add to MetaCart
Much has been said and done about generic programming approaches in stronglytyped functional languages such as Haskell and Agda. Different approaches use different techniques and are better or worse suited for certain uses, depending on design decisions such as generic view, universe size and complexity, etc. We present a simple and intuitive yet powerful approach to generic programming in Agda using indexed functors. We show a universe incorporating fixed points that supports composition, indexing, and isomorphisms, and generalizes a number of previous approaches to generic programming with fixed points. Our indexed functors come with a map operation which obeys the functor laws, and associated recursion morphisms. Albeit expressive, the universe remains simple enough to allow defining standard recursion schemes as well as decidable equality. As for typeindexed datatypes, we show how to compute the type of onehole contexts and define the generic zipper.
Generic selections of subexpressions
, 2010
"... Tools for computer languages need position information: compilers for providing better error messages, structure editors for mapping between structural and textual views, and debuggers for navigating through a term, for instance. Manually adding position information to an abstract syntax tree is ted ..."
Abstract

Cited by 2 (0 self)
 Add to MetaCart
Tools for computer languages need position information: compilers for providing better error messages, structure editors for mapping between structural and textual views, and debuggers for navigating through a term, for instance. Manually adding position information to an abstract syntax tree is tedious and requires pervasive changes: the original tree becomes verbose and every function operating on it needs to be adapted. In this paper, we describe how to automatically extend datatypes with position information using datatypegeneric programming techniques. Furthermore, we show examples of how to use this position information: parsers that automatically construct trees annotated with positions, catamorphisms that deal with failure by reporting error locations, and zippers that efficiently navigate annotated trees. The generic programming technique we describe is applicable to a wide range of domains.
Generic Programming for Domain Reasoners
, 2009
"... An exercise assistant is a tool that supports students learning procedural skills, such as solving systems of linear equations, or rewriting a logic expression to disjunctive normal form. The domain reasoner is the component of an exercise assistant that deals with tasks that depend on the semanti ..."
Abstract

Cited by 1 (1 self)
 Add to MetaCart
(Show Context)
An exercise assistant is a tool that supports students learning procedural skills, such as solving systems of linear equations, or rewriting a logic expression to disjunctive normal form. The domain reasoner is the component of an exercise assistant that deals with tasks that depend on the semantics of a particular domain, for example the rules that may be applied, or the procedure that should be followed when solving an exercise. An exercise assistant typically has multiple domain reasoners, and the behavior of each of these is, to a large extent, determined by the domain. Generic programming techniques claim to reduce code duplication, to make it easier to change the structure of data, and to provide implementations of many useful functions on most datatypes. There are many libraries for generic programming, all with different datatype support, expressiveness, and ease of use. While a lot of effort has been put into developing new libraries in the past few years, there are few examples of reallife applications of generic programming. In this paper we describe our experience with applying generic programming techniques to our domain reasoners implemented in Haskell. We have used the Uniplate, Multirec, and Regular generic programming libraries. We assess and compare the resulting generic domain reasoners with each other and with the initial, nongeneric version, using the software quality factors of the ISO 9126 international standard.
A Haskell Library for Term Rewriting
"... We present a Haskell library for firstorder term rewriting covering basic operations on positions, terms, contexts, substitutions and rewrite rules. This effort is motivated by the increasing number of term rewriting tools that are written in Haskell. 1 ..."
Abstract

Cited by 1 (0 self)
 Add to MetaCart
(Show Context)
We present a Haskell library for firstorder term rewriting covering basic operations on positions, terms, contexts, substitutions and rewrite rules. This effort is motivated by the increasing number of term rewriting tools that are written in Haskell. 1
Generic Programming for Indexed Datatypes
 WGP'11
, 2011
"... An indexed datatype is a type that uses a parameter as a typelevel tag; a typical example is the type of vectors, which are indexed over a typelevel natural number encoding their length. Since the introduction of generalised algebraic datatypes, indexed datatypes have become commonplace in Haskell ..."
Abstract

Cited by 1 (0 self)
 Add to MetaCart
An indexed datatype is a type that uses a parameter as a typelevel tag; a typical example is the type of vectors, which are indexed over a typelevel natural number encoding their length. Since the introduction of generalised algebraic datatypes, indexed datatypes have become commonplace in Haskell. Values of indexed datatypes are often more involved than values of plain datatypes, and programmers would benefit from having generic programs on indexed datatypes. However, no generic programming library adequately supports them, leaving programmers with the tedious task of writing repetitive code. We show how to encode indexed datatypes in a generic programming library with type families and typelevel representations in Haskell. Our approach can also be used in similar libraries, and is fully backwardscompatible. We show not only how to encode indexed datatypes generically, but also how to instantiate generic functions on indexed datatypes. Furthermore, all generic representations and instances are generated automatically, making life easier for users.