Results 1  10
of
21
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 109 (19 self)
 Add to MetaCart
(Show Context)
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 (4 self)
 Add to MetaCart
(Show Context)
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...
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 35 (10 self)
 Add to MetaCart
(Show Context)
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
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 22 (8 self)
 Add to MetaCart
(Show Context)
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.
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 18 (7 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
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 15 (5 self)
 Add to MetaCart
(Show Context)
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...
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 15 (5 self)
 Add to MetaCart
(Show Context)
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
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 ..."
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.
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
Fibrational Induction Meets Effects
"... Abstract. This paper provides several induction rules that can be used to prove properties of effectful data types. Our results are semantic in nature and build upon Hermida and Jacobs ’ fibrational formulation of induction for polynomial data types and its extension to all inductive data types by G ..."
Abstract

Cited by 4 (0 self)
 Add to MetaCart
(Show Context)
Abstract. This paper provides several induction rules that can be used to prove properties of effectful data types. Our results are semantic in nature and build upon Hermida and Jacobs ’ fibrational formulation of induction for polynomial data types and its extension to all inductive data types by Ghani, Johann, and Fumex. An effectful data type µ(T F) is built from a functor F that describes data, and a monad T that computes effects. Our main contribution is to derive induction rules that are generic over all functors F and monads T such that µ(T F) exists. Along the way, we also derive a principle of definition by structural recursion for effectful data types that is similarly generic. Our induction rule is also generic over the kinds of properties to be proved: like the work on which we build, we work in a general fibrational setting and so can accommodate very general notions of properties, rather than just those of particular syntactic forms. We give examples exploiting the generality of our results, and show how our results specialize to those in the literature, particularly those of Filinski and Støvring. 1