Results 1 - 10
of
12
A New Approach to Generic Functional Programming
- In The 27th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages
, 1999
"... This paper describes a new approach to generic functional programming, which allows us to define functions generically for all datatypes expressible in Haskell. A generic function is one that is defined by induction on the structure of types. Typical examples include pretty printers, parsers, and co ..."
Abstract
-
Cited by 84 (13 self)
- Add to MetaCart
This paper describes a new approach to generic functional programming, which allows us to define functions generically for all datatypes expressible in Haskell. A generic function is one that is defined by induction on the structure of types. Typical examples include pretty printers, parsers, and comparison functions. The advanced type system of Haskell presents a real challenge: datatypes may be parameterized not only by types but also by type constructors, type definitions may involve mutual recursion, and recursive calls of type constructors can be arbitrarily nested. We show that--- despite this complexity---a generic function is uniquely defined by giving cases for primitive types and type constructors (such as disjoint unions and cartesian products). Given this information a generic function can be specialized to arbitrary Haskell datatypes. The key idea of the approach is to model types by terms of the simply typed -calculus augmented by a family of recursion operators. While co...
Combining effects: sum and tensor
"... We seek a unified account of modularity for computational effects. We begin by reformulating Moggi’s monadic paradigm for modelling computational effects using the notion of enriched Lawvere theory, together with its relationship with strong monads; this emphasises the importance of the operations ..."
Abstract
-
Cited by 23 (3 self)
- Add to MetaCart
We seek a unified account of modularity for computational effects. We begin by reformulating Moggi’s monadic paradigm for modelling computational effects using the notion of enriched Lawvere theory, together with its relationship with strong monads; this emphasises the importance of the operations that produce the effects. Effects qua theories are then combined by appropriate bifunctors on the category of theories. We give a theory for the sum of computational effects, which in particular yields Moggi’s exceptions monad transformer and an interactive input/output monad transformer. We further give a theory of the commutative combination of effects, their tensor, which yields Moggi’s side-effects monad transformer. Finally we give a theory of operation transformers, for redefining operations when adding new effects; we derive explicit forms for the operation transformers associated to the above monad transformers.
Value Recursion in Monadic Computations
- OGI School of Science and Engineering, OHSU
, 2002
"... viii 1 ..."
Functional pearl: Unfolding pointer algorithms
- Journal of Functional Programming
, 2001
"... A fair amount has been written on the subject of reasoning about pointer algorithms. There was a peak about 1980 when everyone seemed to be tackling the formal verification of the Schorr–Waite marking algorithm, including Gries (1979, Morris (1982) and Topor (1979). Bornat (2000) writes: “The Schorr ..."
Abstract
-
Cited by 6 (0 self)
- Add to MetaCart
A fair amount has been written on the subject of reasoning about pointer algorithms. There was a peak about 1980 when everyone seemed to be tackling the formal verification of the Schorr–Waite marking algorithm, including Gries (1979, Morris (1982) and Topor (1979). Bornat (2000) writes: “The Schorr–Waite algorithm is the
FUNCTIONAL PEARLS Maximum marking problems
"... Here are two puzzles for you to solve. First, consider the binary tree in figure 1. Take apencil (I am assuming that this is your personal copy of JFP!) and mark some of the nodes in such away that the sum of the values of marked nodes is as large aspossible. The catch isthat you cannot mark all the ..."
Abstract
-
Cited by 2 (0 self)
- Add to MetaCart
Here are two puzzles for you to solve. First, consider the binary tree in figure 1. Take apencil (I am assuming that this is your personal copy of JFP!) and mark some of the nodes in such away that the sum of the values of marked nodes is as large aspossible. The catch isthat you cannot mark all the nodes: if you mark
Monadic Style Control Constructs For Inference Systems
, 2002
"... Recent advances in programming languages study and design have established a standard way of grounding computational systems representation in category theory. These formal results led to a better understanding of issues of control and side-e#ects in functional and imperative languages. ..."
Abstract
-
Cited by 1 (1 self)
- Add to MetaCart
Recent advances in programming languages study and design have established a standard way of grounding computational systems representation in category theory. These formal results led to a better understanding of issues of control and side-e#ects in functional and imperative languages.
Program fusion with paramorphisms
- In Mathematically Structured Functional Programming, Proceedings, Electronic Workshops in Computing. British Computer Society
, 2006
"... The design of programs as the composition of smaller ones is a wide spread approach to programming. In functional programming, this approach raises the necessity of creating a good amount of intermediate data structures with the only aim of passing data from one function to another. Using program fu ..."
Abstract
-
Cited by 1 (0 self)
- Add to MetaCart
The design of programs as the composition of smaller ones is a wide spread approach to programming. In functional programming, this approach raises the necessity of creating a good amount of intermediate data structures with the only aim of passing data from one function to another. Using program fusion techniques, it is possible to eliminate many of those intermediate data structures by an appropriate combination of the codes of the involved functions. In the standard case, no mention to the eliminated data structure remains in the code obtained from fusion. However, there are situations in which parts of that data structure becomes an internal value manipulated by the fused program. This happens, for example, when primitive recursive functions (socalled paramorphisms) are involved. We show, for example, that the result of fusing a primitive recursive function p with another function f may give as result a function that contains calls to f. Moreover, we show that in some cases the result of fusion may be less efficient than the original composition. We also investigate a general recursive version of paramorphism. This study is strongly motivated by the development of a fusion tool for Haskell programs called HFUSION.
Overloading and Coherence
"... This article discusses coherence of semantics of languages with support for overloading . A revised definition of coherence is given, that takes into account the fact that, in general, the semantics of an expression with overloaded symbols depends on its type. The article also presents a new rule fo ..."
Abstract
- Add to MetaCart
This article discusses coherence of semantics of languages with support for overloading . A revised definition of coherence is given, that takes into account the fact that, in general, the semantics of an expression with overloaded symbols depends on its type. The article also presents a new rule for detecting ambiguity, which is less restrictive than those typically used in languages like Haskell, with support for overloading and parametric polymorphism. We distinguish between detection of ambiguity in lazy and strict languages. Specifically, a lazy language may consider a larger set of expresions to be well-typed, in comparison to a strict language. We present a new rule that removes all and only terms which are ambiguous, from a language with support for context-dependent overloading and parametric polymorphism. We use it to define a coherent semantics for such a language, by induction on type derivations of a declarative (Hindley-Milner like) type system, without the need of restricting the set of terms according to a separate type inference algorithm, that rules out such ambiguous terms. Furthermore, we present a type inference algorithm and a slightly different and more efficient ambiguity rule, used in this algorithm, that is necessary and sufficient for coherence of a semantics defined by means of the usual approach, namely, by induction on type derivations in a type system that allows ambiguous terms to be typable. 1

