Abstract

AbstractSome programs are doubly generic. For example, map is datatype-generic in that many different data structures support a mapping operation. A generic programming language like Generic Haskell can use a single definition to generate map for each type. However, map is also arity-generic because it belongs to a family of related operations that differ in the number of arguments. For lists, this family includes familiar functions from the Haskell standard library (such as repeat, map, and zipWith).This tutorial explores these forms of genericity individually and together. These two axes are not orthogonal: datatype-generic versions of repeat, map and zipWith have different arities of kind-indexed types. We explore these forms of genericity in the context of the Agda programming language, using the expressiveness of dependent types to capture both forms of genericity in a common framework. Therefore, this tutorial serves as an introduction to dependently typed languages as well as generic programming.The target audience of this work is someone who is familiar with functional programming languages, such as Haskell or ML, but would like to learn about dependently typed languages. We do not assume prior experience with Agda, type- or arity-generic programming.KeywordsEquality FunctionGeneric ProgrammingDependent TypeFunctional ProgrammingArity GenericityThese keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call