Generic Views on Data Types
نویسندگان
چکیده
A generic function is defined by induction on the structure of types. The structure of a data type can be defined in several ways. For example, in PolyP a pattern functor gives the structure of a data type viewed as a fixed point, and in Generic Haskell a structural representation type gives an isomorphic type view of a data type in terms of sums of products. Depending on this generic view on the structure of data types, some generic functions are easier, more difficult, or even impossible to define. Furthermore, the efficiency of some generic functions can be improved by choosing a different view. This paper introduces generic views on data types and shows why they are useful. Furthermore, it shows how generic views have been added to Generic Haskell, an extension of the functional programming language Haskell that supports the construction of generic functions. The separation between inductive definitions on type structure and generic views allows us to combine many approaches to generic programming in a single framework.
منابع مشابه
Software Reuse by Specialization of Generic Procedures Through Views
A generic procedure can be specialized, by compilation through views, to operate directly on concrete data. A view is a computational mapping that describes how a concrete type implements an abstract type. Clusters of related views are needed for specialization of generic procedures that involve several types or several views of a single type. A user interface that reasons about relationships b...
متن کاملCreation of Views for Reuse of Software with Diierent Data Representations in the Automatic Programming Server Demo, Mathematical View Option. a Workstation Running X Windows Is Required
Personal use of this material is permitted. However, permission to reprint/republish this material for advertising or promotional purposes or for creating new collective works for resale or redistribution to servers or lists, or to reuse any copyrighted component of this work in other works must be obtained from the IEEE. Abstract Software reuse is inhibited by the many diierent ways in which e...
متن کامل"Scrap Your Boilerplate" Revolutions
Generic programming allows you to write a function once, and use it many times at different types. Traditionally, generic functions are defined by induction on the structure of types. “Scrap your boilerplate” (SYB) is a radically different approach that dispatches on the structure of values. In previous work, we have shown how to reconcile both approaches using the concept of generic views: man...
متن کاملDevelopment of a Generic Risk Matrix to Manage Project Risks
A generic risk matrix is presented for use identifying and assessing project risks quickly and cost effectively. It assists project managers with few resources to perform project risk analysis. The generic risk matrix (GRM) contains a broad set of risks that are categorized and ranked according to their potential impact and probability of occurrence. The matrix assists PMs in quickly identifyin...
متن کاملConstructing Universes for Generic Programming
Programming languages with an expressive language for defining data types often suffer from an excess in boiler-plate code and lack of re-usable, extendible libraries. Dependently typed programming languages are especially prone to such problems. With dependent types one can specify any number of relationships between data and types, to better specify the correct behaviour of programs. Thus one...
متن کامل