CPL - Chalmers Publication Library
| Utbildning | Forskning | Styrkeområden | Om Chalmers | In English In English Ej inloggad.

PolyLib - a polytypic function library

Patrik Jansson (Institutionen för datavetenskap, Funktionell programmering ; Institutionen för datavetenskap, Programmeringslogik) ; Johan Jeuring
Workshop on Generic Programming (1998)
[Konferensbidrag, refereegranskat]

A polytypic program is a program that behaves uniformly over a large class of datatypes. For functional polytypic programming this uniformity is achieved by parameterizing functions over type constructors to obtain polytypic functions. A polytypic function is defined either by induction on the structure of regular type constructors or in terms of other polytypic functions. PolyP is an extension of the functional programming language Haskell with a construct for defining polytypic functions. PolyP is a type guided preprocessor that generates instances of polytypic functions and inserts applications of these instances where needed. During the last few years we have used PolyP to construct a number of polytypic programs, for example for unification, parsing, rewriting, pattern matching, etc. These polytypic programs use several basic polytypic functions, such as the relatively well-known cata and map, but also less well-known functions such as propagate and thread. We have collected these basic polytypic functions in the library of PolyP: PolyLib. This paper describes the polytypic functions in PolyLib, motivates their presence in the library, and gives a rationale for their design. Thus we hope to share our experience with other researchers in the field. We will assume the reader has some familiarity with the field of polytypic programming. Of course, a library is an important part of a programming language. Languages like Java, Delphi, Perl and Haskell are popular partly because of their useful and extensive libraries. For a polytypic programming language it is even more important to have a clear and well-designed library: writing polytypic programs is difficult, and we do not expect many programmers to write polytypic programs. On the other hand, many programmers use polytypic programs such as parser generators, equality functions, etc. This is a first attempt to describe the library of PolyP; we expect that both the form and content of this description will change over time. One of the goals of this paper is to obtain feedback on the library design from other researchers working within the field. At the moment the library only contains the basic polytypic functions. In the future we will develop special purpose sublibraries for polytypic functions with more advanced functionality, for example for parsing and the other programs mentioned above.

Denna post skapades 2006-10-09. Senast ändrad 2014-09-02.
CPL Pubid: 10125


Institutioner (Chalmers)

Institutionen för datavetenskap, Funktionell programmering (2002-2004)
Institutionen för datavetenskap, Programmeringslogik (2002-2004)


Teoretisk datalogi

Chalmers infrastruktur