Results 1 - 10
of
52
PolyP - a polytypic programming language extension
- POPL '97: The 24th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages
, 1997
"... Many functions have to be written over and over again for different datatypes, either because datatypes change during the development of programs, or because functions with similar functionality are needed on different datatypes. Examples of such functions are pretty printers, debuggers, equality fu ..."
Abstract
-
Cited by 161 (27 self)
- Add to MetaCart
Many functions have to be written over and over again for different datatypes, either because datatypes change during the development of programs, or because functions with similar functionality are needed on different datatypes. Examples of such functions are pretty printers, debuggers, equality functions, unifiers, pattern matchers, rewriting functions, etc. Such functions are called polytypic functions. A polytypic function is a function that is defined by induction on the structure of user-defined datatypes. This paper extends a functional language (a subset of Haskell) with a construct for writing polytypic functions. The extended language type checks definitions of polytypic functions, and infers the types of all other expressions using an extension of Jones ' theories of qualified types and higher-order polymorphism. The semantics of the programs in the extended language is obtained by adding type arguments to functions in a dictionary passing style. Programs in the extended language are translated to Haskell. 1
Polytypic programming
- 2nd Int. School on Advanced Functional Programming
, 1996
"... PolyP extends a functional language (a subset of Haskell) with a construct for defining polytypic functions by induction on the structure of user-defined datatypes. Programs in the extended language are translated to Haskell. PolyLib contains powerful structured recursion operators like catamorphism ..."
Abstract
-
Cited by 86 (12 self)
- Add to MetaCart
PolyP extends a functional language (a subset of Haskell) with a construct for defining polytypic functions by induction on the structure of user-defined datatypes. Programs in the extended language are translated to Haskell. PolyLib contains powerful structured recursion operators like catamorphisms, maps and traversals, as well as polytypic versions of a number of standard functions from functional programming: sum, length, zip, (==), (6), etc. Both the specification of the library and a PolyP implementation are presented.
Bananas in Space: Extending Fold and Unfold to Exponential Types
, 1995
"... Fold and unfold are general purpose functionals for processing and constructing lists. By using the categorical approach of modelling recursive datatypes as fixed points of functors, these functionals and their algebraic properties were generalised from lists to polynomial (sum-of-product) datatypes ..."
Abstract
-
Cited by 84 (5 self)
- Add to MetaCart
Fold and unfold are general purpose functionals for processing and constructing lists. By using the categorical approach of modelling recursive datatypes as fixed points of functors, these functionals and their algebraic properties were generalised from lists to polynomial (sum-of-product) datatypes. However, the restriction to polynomial datatypes is a serious limitation: it precludes the use of exponentials (functionspaces) , whereas it is central to functional programming that functions are first-class values, and so exponentials should be able to be used freely in datatype definitions. In this paper we explain how Freyd's work on modelling recursive datatypes as fixed points of difunctors shows how to generalise fold and unfold from polynomial datatypes to those involving exponentials. Knowledge of category theory is not required; we use Gofer throughout as our meta-language, making extensive use of constructor classes. 1 Introduction During the 1980s, Bird and Meertens [6, 22] d...
Call-by-Value Games
, 1997
"... . A general construction of models of call-by-value from models of call-by-name computation is described. The construction makes essential use of the properties of sum types in common denotational models of call-by-name. When applied to categories of games, it yields fully abstract models of the cal ..."
Abstract
-
Cited by 59 (7 self)
- Add to MetaCart
. A general construction of models of call-by-value from models of call-by-name computation is described. The construction makes essential use of the properties of sum types in common denotational models of call-by-name. When applied to categories of games, it yields fully abstract models of the call-by-value functional language PCFv , which can be extended to incorporate recursive types, and of a language with local references as in Standard ML. 1 Introduction In recent years game semantics has emerged as a novel and intuitively appealing approach to modelling programming languages. Its first success was in providing a syntax-free description of a fully abstract model of PCF [10, 1, 15]; full abstraction results have also been obtained for untyped and recursively typed functional languages, as well as languages with imperative features [12, 3]. However, none of this work addressed the problem of modelling call-by-value languages---a major shortcoming, given that many real-life langua...
Structural Induction and Coinduction in a Fibrational Setting
- Information and Computation
, 1997
"... . We present a categorical logic formulation of induction and coinduction principles for reasoning about inductively and coinductively defined types. Our main results provide sufficient criteria for the validity of such principles: in the presence of comprehension, the induction principle for in ..."
Abstract
-
Cited by 55 (13 self)
- Add to MetaCart
. We present a categorical logic formulation of induction and coinduction principles for reasoning about inductively and coinductively defined types. Our main results provide sufficient criteria for the validity of such principles: in the presence of comprehension, the induction principle for initial algebras is admissible, and dually, in the presence of quotient types, the coinduction principle for terminal coalgebras is admissible. After giving an alternative formulation of induction in terms of binary relations, we combine both principles and obtain a mixed induction/coinduction principle which allows us to reason about minimal solutions X = oe(X) where X may occur both positively and negatively in the type constructor oe. We further strengthen these logical principles to deal with contexts and prove that such strengthening is valid when the (abstract) logic we consider is contextually/functionally complete. All the main results follow from a basic result about adjunc...
Merging Monads and Folds for Functional Programming
- In Advanced Functional Programming, LNCS 925
, 1995
"... . These notes discuss the simultaneous use of generalised fold operators and monads to structure functional programs. Generalised fold operators structure programs after the decomposition of the value they consume. Monads structure programs after the computation of the value they produce. Our progra ..."
Abstract
-
Cited by 46 (2 self)
- Add to MetaCart
. These notes discuss the simultaneous use of generalised fold operators and monads to structure functional programs. Generalised fold operators structure programs after the decomposition of the value they consume. Monads structure programs after the computation of the value they produce. Our programs abstract both from the recursive processing of their input as well as from the side-effects in computing their output. We show how generalised monadic folds aid in calculating an efficient graph reduction engine from an inefficient specification. 1 Introduction Should I structure my program after the decomposition of the value it consumes or after the computation of the value it produces? Some [Bir89, Mee86, Mal90, Jeu90, MFP91] argue in favour of structuring programs after the decomposition of the value they consume. Such syntax directed programs are written using a limited set of recursion functionals. These functionals, called catamorphisms or generalised fold operators are naturally ...
Calculate Polytypically!
- In PLILP'96, volume 1140 of LNCS
, 1996
"... A polytypic function definition is a function definition that is parametrised with a datatype. It embraces a class of algorithms. As an example we define a simple polytypic "crush" combinator that can be used to calculate polytypically. The ability to define functions polytypically adds another leve ..."
Abstract
-
Cited by 41 (3 self)
- Add to MetaCart
A polytypic function definition is a function definition that is parametrised with a datatype. It embraces a class of algorithms. As an example we define a simple polytypic "crush" combinator that can be used to calculate polytypically. The ability to define functions polytypically adds another level of flexibility in the reusability of programming idioms and in the design of libraries of interoperable components.
A Coinduction Principle for Recursive Data Types Based on Bisimulation
, 1996
"... This paper provides foundations for a reasoning principle (coinduction) for establishing the equality of potentially infinite elements of self-referencing (or circular) data types. As it is well-known, such data types not only form the core of the denotational approach to the semantics of programmin ..."
Abstract
-
Cited by 37 (3 self)
- Add to MetaCart
This paper provides foundations for a reasoning principle (coinduction) for establishing the equality of potentially infinite elements of self-referencing (or circular) data types. As it is well-known, such data types not only form the core of the denotational approach to the semantics of programming languages [SS71], but also arise explicitly as recursive data types in functional programming languages like Standard ML [MTH90] or Haskell [HPJW92]. In the latter context, the coinduction principle provides a powerful technique for establishing the equality of programs with values in recursive data types (see examples herein and in [Pit94]).
Set-Theoretical and Other Elementary Models of the lambda-calculus
- Theoretical Computer Science
, 1993
"... Part 1 of this paper is the previously unpublished 1972 memorandum [43], with editorial changes and some minor corrections. Part 2 presents what happened next, together with some further development of the material. The first part begins with an elementary set-theoretical model of the fi-calculus. F ..."
Abstract
-
Cited by 36 (0 self)
- Add to MetaCart
Part 1 of this paper is the previously unpublished 1972 memorandum [43], with editorial changes and some minor corrections. Part 2 presents what happened next, together with some further development of the material. The first part begins with an elementary set-theoretical model of the fi-calculus. Functions are modeled in a similar way to that normally employed in set theory, by their graphs; difficulties are caused in this enterprise by the axiom of foundation. Next, based on that model, a model of the fij-calculus is constructed by means of a natural deduction method. Finally, a theorem is proved giving some general properties of those non-trivial models of the fij-calculus which are continuous complete lattices. The second part begins with a brief discussion of models of the -calculus in set theories with anti-foundation axioms. Next the model of the fi- calculus of Part 1 and also the closely related---but different!---models of Scott [53, 54] and of Engeler [21, 22] are reviewed....

