Results 1  10
of
14
Polytypic Values Possess Polykinded Types
, 2000
"... A polytypic value is one that is defined by induction on the structure of types. In Haskell the type structure is described by the socalled kind system, which distinguishes between manifest types like the type of integers and functions on types like the list type constructor. Previous approaches to ..."
Abstract

Cited by 107 (20 self)
 Add to MetaCart
A polytypic value is one that is defined by induction on the structure of types. In Haskell the type structure is described by the socalled kind system, which distinguishes between manifest types like the type of integers and functions on types like the list type constructor. Previous approaches to polytypic programming were restricted in that they only allowed to parameterize values by types of one fixed kind. In this paper we show how to define values that are indexed by types of arbitrary kinds. It appears that these polytypic values possess types that are indexed by kinds. We present several examples that demonstrate that the additional exibility is useful in practice. One paradigmatic example is the mapping function, which describes the functorial action on arrows. A single polytypic definition yields mapping functions for datatypes of arbitrary kinds including first and higherorder functors. Polytypic values enjoy polytypic properties. Using kindindexed logical relations we prove...
A Generic Programming Extension for Haskell
 Utrecht University
, 1999
"... Many functions can be dened completely generically for all datatypes. Examples include pretty printers (eg show), parsers (eg read), data converters, equality and comparison functions, mapping functions, and so forth. This paper proposes a generic programming extension that enables the user to dene ..."
Abstract

Cited by 40 (5 self)
 Add to MetaCart
Many functions can be dened completely generically for all datatypes. Examples include pretty printers (eg show), parsers (eg read), data converters, equality and comparison functions, mapping functions, and so forth. This paper proposes a generic programming extension that enables the user to dene such functions in Haskell. In particular, the proposal aims at generalizing Haskell's deriving construct, which is commonly considered decient since instance declarations can only be derived for a few predened classes. Using generic denitions derived instances can be specied for arbitrary userdened type classes and for classes that abstract over type constructors of rstorder kind. 1 Introduction Generic or polytypic programming aims at relieving the programmer from repeatedly writing functions of similar functionality for dierent datatypes. Typical examples for socalled generic functions include pretty printers (eg show), parsers (eg read), functions that convert data into a u...
The essence of the Iterator pattern
 McBride, Conor, & Uustalu, Tarmo (eds), Mathematicallystructured functional programming
, 2006
"... The ITERATOR pattern gives a clean interface for elementbyelement access to a collection. Imperative iterations using the pattern have two simultaneous aspects: mapping and accumulating. Various existing functional iterations model one or other of these, but not both simultaneously. We argue that ..."
Abstract

Cited by 17 (8 self)
 Add to MetaCart
The ITERATOR pattern gives a clean interface for elementbyelement access to a collection. Imperative iterations using the pattern have two simultaneous aspects: mapping and accumulating. Various existing functional iterations model one or other of these, but not both simultaneously. We argue that McBride and Paterson’s idioms, and in particular the corresponding traverse operator, do exactly this, and therefore capture the essence of the ITERATOR pattern. We present some axioms for traversal, and illustrate with a simple example, the repmin problem.
Generic trace semantics via coinduction
 Logical Methods in Comp. Sci
, 2007
"... Abstract. Trace semantics has been defined for various kinds of statebased systems, notably with different forms of branching such as nondeterminism vs. probability. In this paper we claim to identify one underlying mathematical structure behind these “trace ..."
Abstract

Cited by 17 (6 self)
 Add to MetaCart
Abstract. Trace semantics has been defined for various kinds of statebased systems, notably with different forms of branching such as nondeterminism vs. probability. In this paper we claim to identify one underlying mathematical structure behind these “trace
Polytypic Programming With Ease
, 1999
"... A functional polytypic program is one that is parameterised by datatype. Since polytypic functions are defined by induction on types rather than by induction on values they typically operate on a higher level of abstraction than their monotypic counterparts. However, polytypic programming is not nec ..."
Abstract

Cited by 13 (5 self)
 Add to MetaCart
A functional polytypic program is one that is parameterised by datatype. Since polytypic functions are defined by induction on types rather than by induction on values they typically operate on a higher level of abstraction than their monotypic counterparts. However, polytypic programming is not necessarily more complicated than conventional programming. We show that a polytypic function is uniquely defined by its action on constant functors, projection functors, sums, and products. This information is sufficient to specialize a polytypic function to arbitrary polymorphic datatypes, including mutually recursive datatypes and nested datatypes. The key idea is to use infinite trees as index sets for polytypic functions and to interpret datatypes as algebraic trees. This approach appears both to be simpler, more general, and more efficient than previous ones which are based on the initial algebra semantics of datatypes. Polytypic functions enjoy polytypic properties. We show that wellkno...
Promotional Transformation on Monadic Programs
, 1995
"... this paper, we propose a new theory on monadic catamorphism bymoving Fokkinga's assumption on the monad to the condition of a map between monadic algebras so that our theory is valid for arbitrary monads including, for example, the state monad that is not allowed in Fokkinga's theory. Our theory cov ..."
Abstract

Cited by 9 (0 self)
 Add to MetaCart
this paper, we propose a new theory on monadic catamorphism bymoving Fokkinga's assumption on the monad to the condition of a map between monadic algebras so that our theory is valid for arbitrary monads including, for example, the state monad that is not allowed in Fokkinga's theory. Our theory covers Fokkinga's as a special case. Moreover, Meijer and Jeuring's informal transformation rules of monadic programs in their case study is actually an instance of our general promotion theorem.
Generic trace theory
 International Workshop on Coalgebraic Methods in Computer Science (CMCS 2006), volume 164 of Elect. Notes in Theor. Comp. Sci
, 2006
"... Trace semantics has been defined for various nondeterministic systems with different input/output types, or with different types of “nondeterminism ” such as classical nondeterminism (with a set of possible choices) vs. probabilistic nondeterminism. In this paper we claim that these various forms ..."
Abstract

Cited by 8 (4 self)
 Add to MetaCart
Trace semantics has been defined for various nondeterministic systems with different input/output types, or with different types of “nondeterminism ” such as classical nondeterminism (with a set of possible choices) vs. probabilistic nondeterminism. In this paper we claim that these various forms of “trace semantics” are instances of a single categorical construction, namely coinduction in a Kleisli category. This claim is based on our main technical result that an initial algebra in
T.: Compositional Data Types
 In: Proceedings of the Seventh ACM SIGPLAN Workshop on Generic Programming
, 2011
"... In previous work we have illustrated the benefits that compositional data types (CDTs) offer for implementing languages and in general for dealing with abstract syntax trees (ASTs). Based on Swierstra’s data types à la carte, CDTs are implemented as a Haskell library that enables the definition of r ..."
Abstract

Cited by 6 (2 self)
 Add to MetaCart
In previous work we have illustrated the benefits that compositional data types (CDTs) offer for implementing languages and in general for dealing with abstract syntax trees (ASTs). Based on Swierstra’s data types à la carte, CDTs are implemented as a Haskell library that enables the definition of recursive data types and functions on them in a modular and extendable fashion. Although CDTs provide a powerful tool for analysing and manipulating ASTs, they lack a convenient representation of variable binders. In this paper we remedy this deficiency by combining the framework of CDTs with Chlipala’s parametric higherorder abstract syntax (PHOAS). We show how a generalisation from functors to difunctors enables us to capture PHOAS while still maintaining the features of the original implementation of CDTs, in particular its modularity. Unlike previous approaches, we avoid socalled exotic terms without resorting to abstract types: this is crucial when we want to perform transformations on CDTs that inspect the recursively computed CDTs, e.g. constant folding. 1
The Calculation of a Polytypic Parser
, 1996
"... In this paper it is shown how inverses can be used to calculate a parser. A polytypic unparser is given and by using rules for calculating inverses a polytypic parser is calculated from it. It can be instantiated automatically for all data types that can be described by a regular functor. The idea t ..."
Abstract

Cited by 5 (0 self)
 Add to MetaCart
In this paper it is shown how inverses can be used to calculate a parser. A polytypic unparser is given and by using rules for calculating inverses a polytypic parser is calculated from it. It can be instantiated automatically for all data types that can be described by a regular functor. The idea that a parser can be calculated as the inverse of an unparser is not new, but because polytypical functions are used here the calculated parser is very general. Inverses are defined in a general way and rules are given to calculate them. The set monad has a strong connection with inverses and for many monadic concepts the instantiation with this monad gives rise to rules about inverses. In this way the inverses of catamorphisms and anamorphisms can be characterized. As we know that the unparser and the rules that were used in the calculation are correct, the calculated parser is known to be correct too. In general the parser that results from such a calculation is not very efficient and it is possible to construct much more efficient parsers by hand. Because it is possible to prove the equality of these two parsers, this parser is correct too. An implementation of parsers for a small subset of html and latex is given as an illustration of how the polytypic functions are instantiated for a particular datatype. Contents 1
Outofcore Functional Programming with Typebased Primitives
 In Proceedings of the 2nd International Workshop on Practical Aspects of Declarative Languages
, 2000
"... . We formulate and experiment with typebased primitives (such as fold and unfold operations) for outofcore processing of functional data structures. We follow the view that recursive data types are fixed points of polynomial type constructors. This view leads to a clear separation of the sema ..."
Abstract

Cited by 1 (0 self)
 Add to MetaCart
. We formulate and experiment with typebased primitives (such as fold and unfold operations) for outofcore processing of functional data structures. We follow the view that recursive data types are fixed points of polynomial type constructors. This view leads to a clear separation of the semantics and the implementations of recursive data types. We provide monadic implementations of the typebased primitives so that the intermediate data structures used for the executions of the primitives can be placed in outofcore storage. The parametric module facility of Objective Caml is further used to package the outofcore implementations. The resulting outofcore user code retains the same program structure of the incore user code and can be as elegant. 1 Motivation In programming languages supporting automatic memory management, a program need not explicitly request storage for data during the execution. The runtime system allocates space for new data, and reclaims space ...