1. You can enlarge the whole site (character size and with) by using the browser function to change characters size.

2. To your right it is possible to change the character size, font, spacing, characters and letters as well as adjust the colours. This will have consequences for the appearance of the whole website design. It will effect all pages at the University  of Gothenburg's website. The changes will remain the next time you log in. (To save your changes the browser must allow cookies.)

*Changes has been made to the look of this website

  • Home
  • A Pattern for Almost Compositional Functions

A Pattern for Almost Compositional Functions

Journal of Functional Programming
Year of publication: 
Scientific journal article - peer reviewed

This paper introduces a pattern for almost compositional functions over recursive data types, and over families of mutually recursive data types. Here "almost compositional" means that for all of the constructors in the type(s), except a limited number of them, the result of the function depends only on the constructor and the results of calling the function on the constructor's arguments. The pattern consists of a generic part constructed once for each data type or family of data types, and a task-specific part. The generic part
contains the code for the predictable compositional cases, leaving the interesting work to the task-specific part. Examples of the pattern are given, implemented in dependent type theory with inductive families, in Haskell with
generalized algebraic data types and rank-2 polymorphism, and in Java using a variant of the Visitor design pattern. The relationships to the "Scrap Your Boilerplate" approach to generic programming, and to general tree types in dependent type theory, are investigated by reimplementing our operations using those frameworks.

To the top

Page updated: 2012-01-30 14:01

Send as email
Print page
Show as pdf