| Bird, R., de Moor, O., Hoogendijk, P.: Generic functional programming with types and relations. Journal of Functional Programming 6 (1996) 1--28 |
....#a#, then this function depends on the function eq##a#. Depending on means that in order to call function eq#List #a# on two lists, we need a function eq##a# that determines equality of the values in the list, as in the following example, let eq##a# = #x #y eqInt x y in eq#List #a# [ 1, 2, 3] [ 1, 2, 3] let eq##a# = #c toUpper c toUpper d in eq#List #a# Hello HELLO ) which has value (True, True) The type of the Classic (i.e. the first) version of eq is the kind indexed type Eq . Consider the case eq#Prod#. The product type has kind # #, and hence eq#Prod# takes ....
....this function depends on the function eq##a#. Depending on means that in order to call function eq#List #a# on two lists, we need a function eq##a# that determines equality of the values in the list, as in the following example, let eq##a# = #x #y eqInt x y in eq#List #a# [ 1, 2, 3] [ 1, 2, 3], let eq##a# = #c toUpper c toUpper d in eq#List #a# Hello HELLO ) which has value (True, True) The type of the Classic (i.e. the first) version of eq is the kind indexed type Eq . Consider the case eq#Prod#. The product type has kind # #, and hence eq#Prod# takes an equality ....
[Article contains additional citation context not shown here]
Richard Bird, Oege de Moor, and Paul Hoogendijk. Generic functional programming with types and relations. Journal of Functional Programming, 6(1):1--28, 1996.
....parametricity theorem [35] implies that a function of type . A Preprint submitted to Elsevier Science 30 August 2001 must necessarily be constant. As a consequence, the programmer is forced to program a separate equality function for each type from scratch. Polytypic programming [3,2] addresses this problem. Actually, equality serves as a standard example of a polytypic function that can be defined by induction on the structure of types. In a previous paper [12] the author has shown that polytypic functions are uniquely defined by giving cases for primitive types, the unit ....
Richard Bird, Oege de Moor, and Paul Hoogendijk. Generic functional programming with types and relations. Journal of Functional Programming, 6(1):1--28, January 1996.
....structure multiplication, is explained in [HB97] We finish with two uses that have been directly inspired by investigations into the area of nested datatypes. First, zips are used in one possible extension to nested datatypes of the substructures operation, a special case of the scan operation [BdMH96, BGB]. Secondly, Borges [Bor01] uses zips to write embedding functions for nested datatypes. 122 7.1.5 Multirelators Hoogendijk defines zips for all regular relators and we shall generalise his work to linear nested relators. However, he extends the definition of regular relators to what he calls ....
....terms of the way in which argument families are constructed. As we explain in Chapter 2, Blampied constructs fusion laws in an ad hoc way. However, he suggests in his conclusion that the use of combinators for constructing algebra families may give more general fusion laws. The scan operation [BdMH96] on trees labels each node with the result of folding the subtree rooted at that node. It can be generalised to any regular datatype by generalising subtrees to substructures. However, it is di#cult to generalise the notion of substructures to nested datatypes. Each of the imperfect possibilities ....
Richard Bird, Oege de Moor, and Paul Hoogendijk. Generic functional programming with types and relations. Journal of Functional Programming, 6(1):1--28, 1996.
....from Haskell we use identi ers starting with an upper case letter for types (this includes type variables) and identi ers starting with a lower case letter for values (this includes data constructors) Example 2: Pattern matching. The polytypic functions for the maximum segment sum problem [2] and pattern matching [23] use labelled data types. These labelled data types, introduced in [2] are used to store at each node the subtree rooted at that node, or a set of patterns (trees with variables) matching at a subtree, etc. For example, the data type of labelled bushes is de ned by ....
....type variables) and identi ers starting with a lower case letter for values (this includes data constructors) Example 2: Pattern matching. The polytypic functions for the maximum segment sum problem [2] and pattern matching [23] use labelled data types. These labelled data types, introduced in [2], are used to store at each node the subtree rooted at that node, or a set of patterns (trees with variables) matching at a subtree, etc. For example, the data type of labelled bushes is de ned by data Lab Bush L = label Leaf Char L j label Fork (Lab Bush L) Lab Bush L) L: In the following ....
[Article contains additional citation context not shown here]
Richard Bird, Oege de Moor, and Paul Hoogendijk. Generic functional programming with types and relations. Journal of Functional Programming, 6(1):1-28, 1996.
....from Haskell we use identifiers starting with an upper case letter for types (this includes type variables) and identifiers starting with a lower case letter for values (this includes data constructors) Example 2: Pattern matching. The polytypic functions for the maximum segment sum problem [2] and pattern matching [22] use labelled data types. These labelled data types, introduced in [2] are used to store at each node the subtree rooted at that subtree, or a set of patterns (trees with variables) matching at a subtree, etc. For example, the data type of labelled bushes is defined by ....
....type variables) and identifiers starting with a lower case letter for values (this includes data constructors) Example 2: Pattern matching. The polytypic functions for the maximum segment sum problem [2] and pattern matching [22] use labelled data types. These labelled data types, introduced in [2], are used to store at each node the subtree rooted at that subtree, or a set of patterns (trees with variables) matching at a subtree, etc. For example, the data type of labelled bushes is defined by data Lab Bush L = label Leaf Char L label Fork (Lab Bush L) Lab Bush L) L. In the following ....
[Article contains additional citation context not shown here]
Richard Bird, Oege de Moor, and Paul Hoogendijk. Generic functional programming with types and relations. Journal of Functional Programming, 6(1):1--28, 1996.
.... Point free relation calculus and its categorical generalizations have been fruitful in development of calculi of functional programming, especially in formulation and proof of general principles for optimization problems and polytypic patterns of recursion on inductive data types (see [4, 6 8] and many citations therein) Applied to speci c problems, however, point free expressions can be less convenient and comprehensible than pointwise ones (cf. lambda terms versus combinators) In imperative programming, pointwise notation is the norm, but it is tied to state variables and ....
R. Bird, O. de Moor, and P. Hoogendijk. Generic functional programming with types and relations. Journal of Functional Programming, 6:1-28, 1996.
....and anamorphisms it is indispensable for others. The polytypic uni cation algorithm described by P. Jansson and J. Jeuring [15] for instance, requires a function that determines the immediate subterms of a term. A similar function appears in the article of R. Bird, O. de Moor, and P. Hoogendijk [4], who present a generalization of the maximum segment sum problem. In both cases the recursive structure of a datatype must be known. Now, since our framework deals with type recursion on the meta level, one could feel tempted to conclude that we cannot deal with such applications. It appears, ....
Richard Bird, Oege de Moor, and Paul Hoogendijk. Generic functional programming with types and relations. Journal of Functional Programming, 6(1):1-28, January 1996.
.... relation calculus and its categorical generalizations have been fruitful in development of calculi of functional programming, especially for formulation and proof of general principles such as theories of optimization problems and polytypic patterns of recursion on inductive data types (e.g. see [2 5] and many citations therein) In such a programming calculus, the idea is to start with a relation R : B C that serves as a speci cation, and to construct a chain R R 0 : f (1) of inclusions, leading to a function f expressed in the target programming language. A rich calculus can ....
R. Bird, O. de Moor, and P. Hoogendijk. Generic functional programming with types and relations. Journal of Functional Programming, 6:1-28, 1996.
....how to de ne a zipper for an arbitrary data type. This is a rather involved example of a typeindexed data type, together with some type indexed functions that take an argument of a type indexed data type. Example 3: Pattern matching. The polytypic functions for the maximum segment sum problem [2] and pattern matching [21] use labelled data types. These labelled data types, introduced in [2] are used to store at each node the subtree rooted at that subtree, or a set of patterns (trees with variables) matching at a subtree, etc. For example, the data type of labelled bushes is de ned by ....
....data type, together with some type indexed functions that take an argument of a type indexed data type. Example 3: Pattern matching. The polytypic functions for the maximum segment sum problem [2] and pattern matching [21] use labelled data types. These labelled data types, introduced in [2], are used to store at each node the subtree rooted at that subtree, or a set of patterns (trees with variables) matching at a subtree, etc. For example, the data type of labelled bushes is de ned by data LabBush L = labelLeaf Char L j labelFork (LabBush L) LabBush L) L: In the following ....
[Article contains additional citation context not shown here]
Richard Bird, Oege de Moor, and Paul Hoogendijk. Generic functional programming with types and relations. Journal of Functional Programming, 6(1):1-28, 1996.
....b into a function map : a b) d a d b, so that it too works for trees and other similar datatypes. We call such functions polytypic functions. For an introduction to the basic ideas of polytypic functions see (Jeuring Jansson, 1996) and for a more theoretical treatment of polytypism (Bird et al. 1996) and (de Moor, 1994) In this paper we show that ffl by parametrising the unification algorithm by the datatype for terms, we can separate the core of the algorithm from the parts depending on the specific datatype, and ffl by abstracting away from the type constructor dependence in the ....
Bird, Richard, de Moor, Oege, & Hoogendijk, Paul. (1996). Generic functional programming with types and relations. Journal of Functional Programming, 6(1), 1--28.
....1 Introduction A generic, or polytypic, function is one that the programmer writes once, but which works over many di erent data types. The standard examples are parsing and printing, serialising, taking equality, ordering, hashing, and so on. There is lots of work on generic programming [2, 8, 1, 6]. In this paper we present the design and implementation of an extension to Haskell that supports generic programming. At rst sight it might seem that Haskell s type classes are in competition with generic programming after all, both concern functions that work over many data types. But we ....
Richard Bird, Oege de Moor, and Paul Hoogendijk. Generic functional programming with types and relations. Journal of Functional Programming, 6(1):1-28, January 1996.
....equality function that works for all types the parametricity theorem (Wadler, 1989) implies that a function of type 8a:a a Bool must necessarily be constant. As a consequence, the programmer is forced to program a separate equality function for each type from scratch. Polytypic programming (Bird et al. 1996; Backhouse et al. 1999) addresses this problem. Actually, equality serves as a standard example of a polytypic function that can be de ned by induction on the structure of types. In a previous paper (Hinze, 2000) the author has shown that polytypic functions are uniquely de ned by giving cases ....
Bird, Richard, de Moor, Oege, & Hoogendijk, Paul. (1996). Generic functional programming with types and relations. Journal of functional programming, 6(1), 1-28.
....polymorphic equality function that works for all types the parametricity theorem [29] implies that a function of type 8a:a a Bool must necessarily be constant. As a consequence, the programmer is forced to program a separate equality function for each type from scratch. Polytypic programming [3, 2] addresses this problem. Actually, equality serves as a standard example of a polytypic function that can be de ned by induction on the structure of types. In a previous paper [8] the author has shown that polytypic functions are uniquely de ned by giving cases for primitive types, the unit type, ....
Richard Bird, Oege de Moor, and Paul Hoogendijk. Generic functional programming with types and relations. Journal of Functional Programming, 6(1):1-28, January 1996.
....1 Introduction A generic, or polytypic, function is one that the programmer writes once, but which works over many di erent data types. The standard examples are parsing and printing, serialising, taking equality, ordering, hashing, and so on. There is lots of work on generic programming (Bird et al. 1996; Jansson Jeuring, 1997; Backhouse et al. 1999; Hinze, 2000b) In this paper we present the design and implementation of an extension to Haskell that supports generic programming. At rst sight it might seem that Haskell s type classes are in competition with generic programming after all, ....
Bird, R., de Moor, O. and Hoogendijk, P. (1996) Generic functional programming with types and relations. Journal of Functional Programming 6(1):1-28.
....program in this sense eliminates the unwanted ad hockery. The categorical approach to datatypes popularized by Malcolm [16] is an early example of generic programming: it allows a single unified definition of operations such as map and fold, parameterized by the datatype concerned. Bird et al. [2] generalize upwards accumulation to an arbitrary polynomial datatype, unifying the previous ad hoc definitions. In this paper, we generalize downwards accumulation to an arbitrary polynomial datatype too. This is a more difficult problem: whereas the descendants of a node in a data structure (some ....
....section with a summary of notation. The remainder of the paper is structured as follows. In Section 2 we recall the monotypic definitions of upwards and downwards accumulations on trees from [8, 9] We briefly summarize the theory of datatypes in Section 3. In Section 4 we discuss Bird et al. s [2] generic definition of upwards accumulations. In Section 5 we develop a polytypic definition of paths in a datatype, which we use in Section 6 to give a polytypic definition of downwards accumulations. This simple definition is inefficient; in Section 7 we show how to make it efficient. Section 8 ....
[Article contains additional citation context not shown here]
Richard Bird, Oege de Moor, and Paul Hoogendijk. Generic functional programming with types and relations. Journal of Functional Programming, 6(1):1--28, 1996. Polytypic Downwards Accumulations 27
....in this sense eliminates the unwanted ad hockery. The categorical approach to datatypes popularized by Malcolm [17] is an early example of generic programming: it allows a single uni ed de nition of operations such as map, fold and unfold, parameterized by the datatype concerned. Bird et al. [1] generalize upwards accumulation to an arbitrary regular datatype, unifying the previous ad hoc de nitions. In this paper, we generalize downwards accumulation to an arbitrary regular datatype too. This is a more dicult problem: whereas the descendants of a node in a data structure (some kind of ....
.... b List a List b scanr f e [ e] scanr f e (a:x) f a (head x ) x where x = scanr f e x (Here, a:x is the non empty list with head a and tail x, and the function head satis es head (a:x) a. The notation is essentially that of Haskell [20] For example, scanr ( 0 [1,2,3] = 6,5,3,0] Here, is the addition operator passed as an argument, and [1,2,3] a list with three elements. Rightwards accumulation, of course, distributes information in the opposite direction: scanl : b a b) b List a List b scanl f e [ e] scanl f e (a:x) e : ....
[Article contains additional citation context not shown here]
Richard Bird, Oege de Moor, and Paul Hoogendijk. Generic functional programming with types and relations. Journal of Functional Programming, 6(1):1-28, 1996.
....notions underlying the methodology, of which reductivity is one, are thus also so parameterised. Although the name polytypic programming has only recently come into being the principal ideas began to chrystallize around the mid to late eighties, and are evident in several published papers [7,12,8,2,5,9]. The current paper is complementary to the paper presented at the 1995 MPC conference [3] The latter paper was primarily concerned with presenting a Preprint submitted to Elsevier Preprint 6 October 1995 reductivity calculus and not so much emphasis was placed on motivating the notion. In this ....
R.S. Bird, O. de Moor, and P. Hoogendijk. Generic functional programming with types and relations. J. of Functional Programming, 1995. To appear.
....which is, respectively, somewhat and hardly. However, eq is or can be defined as a polytypic function; see e.g. Sheard [34] Other terms that have been used for the same concept are structural polymorphism (Ruehr [33] generic programming (de Moor [5] Bird, de Moor and Hoogendijk [4]) and type parametric programming (Sheard [34] 3 Some historical remarks In what I ll refer to as classic BMF [28] 2] a.k.a. Squiggol , the focus was on lists, with particular emphasis on a symmetric view in which lists are built up from the empty list constructor [ the ....
....application to deriving actual programs by calculation was initially largely confined to instantiations for, each time, one specific datatype. The first calculational derivation of an actual polytypic algorithm that I saw, and an elegant one at that, was the one in Bird, de Moor and Hoogendijk [4]. Earlier work by Bird and de Moor on solving a variety of optimisation problems by calculation was polytypically unified by de Moor in [5] Several further examples of polytypic calculations can be found in Bird and de Moor [3] The most impressive polytypic algorithms today are those developed ....
Richard Bird, Oege de Moor and Paul Hoogendijk. Generic functional programming with types and relations. J. of Functional Programming, 6(1):1--28, 1996.
....b into a function pmap : a b) d a d b, so that it too works for trees and other similar datatypes. We call such functions polytypic functions. For an introduction to the basic ideas of polytypic functions see (Jeuring Jansson, 1996) and for a more theoretical treatment of polytypism (Bird et al. 1996) and (de Moor, 1994) In this paper we show that ffl by parametrising the unification algorithm by the datatype for terms, we can separate the core of the algorithm from the parts depending on the specific datatype, and ffl by abstracting away from the type constructor dependence in the datatype ....
Bird, Richard, de Moor, Oege, & Hoogendijk, Paul. (1996). Generic functional programming with types and relations. Journal of Functional Programming, 6(1), 1--28.
....b into a function pmap : a b) d a d b, so that it too works for trees and other similar datatypes. We call such functions polytypic functions. For an introduction to the basic ideas of polytypic functions see (Jeuring Jansson, 1996) and for a more theoretical treatment of polytypism (Bird et al. 1996) and (de Moor, 1994) In this paper we show that ffl by parametrising the unification algorithm by the datatype for terms, we can separate the core of the algorithm from the parts depending on the specific datatype, and ffl by abstracting away from the type constructor dependence in the datatype ....
Bird, Richard, de Moor, Oege, & Hoogendijk, Paul. (1996). Generic functional programming with types and relations. Journal of Functional Programming, 6(1), 1--28.
....and hylomorphisms by Fokkinga, Meijer and Paterson [24] Malcolm referred to promotion rather than fusion , that being the terminology used by Bird [6] at the time in his theory of lists. Since then the theme of polytypism has been explored in a variety of ways. Several authors [4, 16, 23] have explored polytypic generalisations of existing programming problems, Doornbos [9, 8, 10] has developed a polytypic theory of program termination and the recently published book by Bird and De Moor [5] contains a wealth of material in which parameterisation by a datatype plays a central ....
Richard Bird, Oege de Moor, and Paul Hoogendijk. Generic functional programming with types and relations. J. of Functional Programming, 6(1):1--28, January 1996. 32
.... programs are programs that are parameterised by type constructors (functions from types to types, like list) rather than types (like integer or list of integer) Currently there is much effort going into developing both practical applications of generic programming and the underlying theory [22, 5, 7, 10, 16, 15, 17, 14, 18]. A major drawback of the current state of the art, however, is that generic programs are typically defined by induction on the structure of the type constructors. This leads to long involved case analyses (for the cases disjoint sum, cartesian product, inductive types etc. An example can be ....
Richard Bird, Oege de Moor, and Paul Hoogendijk. Generic functional programming with types and relations. J. of Functional Programming, 6(1):1--28, January 1996.
....parameter; and instead of an underlying signature of basic functions we assume a category of partial functions with a few extra properties. The importance of these differences has to do with the emerging interest in the area of so called polytypic programs, the current focus of research in the BMF [3, 4, 11, 15, 12]. Such programs are parametrised by type constructors (as opposed to polymorphic programs which are parametrised by types) Beginning with the work of Malcolm [18] it has been observed that several programming concepts and building blocks can be profitably formulated in polytypic terms thus ....
....value, also known as the strength of the powerset functor. Defined as a comprehension, it is str P : S ; x ) f(y ; x ) j y 2 Sg In general the strength of a functor F is a natural transformation from (FA) Theta B to F(A Theta B) which has interesting links with the concept of membership [4]. A related function, definable in terms of the strength, is stl P : x ; S ) f(x ; y) j y 2 Sg: stl P ; A ; B = map P :swap B ; A ffi str P ; B ; A ffi swap A ; PB The crossproduct can then be computed by two applications of these functions: one of each, one nested. At the level of sets, it ....
[Article contains additional citation context not shown here]
Richard Bird, Oege de Moor, and Paul Hoogendijk. Generic functional programming with types and relations. J. of Functional Programming, 6(1):1--28, January 1996.
No context found.
Bird, R., de Moor, O., Hoogendijk, P.: Generic functional programming with types and relations. Journal of Functional Programming 6 (1996) 1--28
No context found.
Bird, R., de Moor, O., Hoogendijk, P.: Generic functional programming with types and relations. Journal of Functional Programming 6 (1996) 1--28
No context found.
R. Bird, O. de Moor, and P. Hoogendijk. Generic functional programming with types and relations. Journal of Functional Programming, 6(1):1--28, 1996.
No context found.
Richard Bird, Oege de Moor, and Paul Hoogendijk. Generic functional programming with types and relations. Journal of Functional Programming, 6(1):1--28, 1996.
No context found.
R. Bird, O. de Moor, P. Hoogendijk, Generic functional programming with types and relations, Journal of Functional Programming 6 (1) (1996) 1--28.
No context found.
R. Bird, O. de Moor, and P. Hoogendijk. Generic functional programming with types and relations. J. of Func. Prog., 6(1):1--28, 1996.
No context found.
Richard Bird, Oege de Moor, and Paul Hoogendijk. Generic functional programming with types and relations. Journal of Functional Programming, 6(1):1--28, 1996.
No context found.
Richard Bird, Oege de Moor, and Paul Hoogendijk. Generic functional programming with types and relations. Journal of Functional Programming, 6(1):1-28, 1996.
No context found.
R. Bird, O. de Moor, P. Hoogendijk, Generic functional programming with types and relations, Journal of Functional Programming 6 (1) (1996) 1--28.
No context found.
R. Bird, O. de Moor, and P. Hoogendijk. Generic functional programming with types and relations. J. of Func. Prog., 6(1):1-28, 1996.
No context found.
Richard Bird, Oege de Moor, and Paul Hoogendijk. Generic functional programming with types and relations. Journal of Functional Programming, 6(1):1-28, January 1996.
Online articles have much greater impact More about CiteSeer.IST Add search form to your site Submit documents Feedback
CiteSeer.IST - Copyright Penn State and NEC