Results 1  10
of
103
Polytypic programming
, 2000
"... ... PolyP extends a functional language (a subset of Haskell) with a construct for defining polytypic functions by induction on the structure of userdefined datatypes. Programs in the extended language are translated to Haskell. PolyLib contains powerful structured recursion operators like catamorp ..."
Abstract

Cited by 95 (11 self)
 Add to MetaCart
(Show Context)
... PolyP extends a functional language (a subset of Haskell) with a construct for defining polytypic functions by induction on the structure of userdefined 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.
Stream Fusion. From Lists to Streams to Nothing at All
 ICFP’07
, 2007
"... This paper presents an automatic deforestation system, stream fusion, based on equational transformations, that fuses a wider range of functions than existing shortcut fusion systems. In particular, stream fusion is able to fuse zips, left folds and functions over nested lists, including list compr ..."
Abstract

Cited by 68 (7 self)
 Add to MetaCart
This paper presents an automatic deforestation system, stream fusion, based on equational transformations, that fuses a wider range of functions than existing shortcut fusion systems. In particular, stream fusion is able to fuse zips, left folds and functions over nested lists, including list comprehensions. A distinguishing feature of the framework is its simplicity: by transforming list functions to expose their structure, intermediate values are eliminated by general purpose compiler optimisations. We have reimplemented the Haskell standard List library on top of our framework, providing stream fusion for Haskell lists. By allowing a wider range of functions to fuse, we see an increase in the number of occurrences of fusion in typical Haskell programs. We present benchmarks documenting time and space improvements.
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 51 (2 self)
 Add to MetaCart
(Show Context)
. 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 sideeffects 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 ...
Deriving Structural Hylomorphisms From Recursive Definitions
 In ACM SIGPLAN International Conference on Functional Programming
, 1996
"... this paper, we propose an algorithm which can automatically turn all practical recursive definitions into structural hylomorphisms making program fusion be easily applied. 1 Introduction ..."
Abstract

Cited by 49 (17 self)
 Add to MetaCart
this paper, we propose an algorithm which can automatically turn all practical recursive definitions into structural hylomorphisms making program fusion be easily applied. 1 Introduction
Shortcut Fusion for Accumulating Parameters Ziplike Functions
, 2002
"... We present an alternative approach to shortcut fusion based on the function unfoldr. Despite its simplicity the technique can remove intermediate lists in examples which are known to be difficult. We show that it can remove all lists from definitions involving ziplike functions and functions using ..."
Abstract

Cited by 47 (0 self)
 Add to MetaCart
We present an alternative approach to shortcut fusion based on the function unfoldr. Despite its simplicity the technique can remove intermediate lists in examples which are known to be difficult. We show that it can remove all lists from definitions involving ziplike functions and functions using accumulating parameters.
Foundations for structured programming with GADTs
 Conference record of the ACM SIGPLANSIGACT Symposium on Principles of Programming Languages
, 2008
"... GADTs are at the cutting edge of functional programming and become more widely used every day. Nevertheless, the semantic foundations underlying GADTs are not well understood. In this paper we solve this problem by showing that the standard theory of data types as carriers of initial algebras of fun ..."
Abstract

Cited by 40 (5 self)
 Add to MetaCart
GADTs are at the cutting edge of functional programming and become more widely used every day. Nevertheless, the semantic foundations underlying GADTs are not well understood. In this paper we solve this problem by showing that the standard theory of data types as carriers of initial algebras of functors can be extended from algebraic and nested data types to GADTs. We then use this observation to derive an initial algebra semantics for GADTs, thus ensuring that all of the accumulated knowledge about initial algebras can be brought to bear on them. Next, we use our initial algebra semantics for GADTs to derive expressive and principled tools — analogous to the wellknown and widelyused ones for algebraic and nested data types — for reasoning about, programming with, and improving the performance of programs involving, GADTs; we christen such a collection of tools for a GADT an initial algebra package. Along the way, we give a constructive demonstration that every GADT can be reduced to one which uses only the equality GADT and existential quantification. Although other such reductions exist in the literature, ours is entirely local, is independent of any particular syntactic presentation of GADTs, and can be implemented in the host language, rather than existing solely as a metatheoretical artifact. The main technical ideas underlying our approach are (i) to modify the notion of a higherorder functor so that GADTs can be seen as carriers of initial algebras of higherorder functors, and (ii) to use left Kan extensions to trade arbitrary GADTs for simplerbutequivalent ones for which initial algebra semantics can be derived.
Tupling Calculation Eliminates Multiple Data Traversals
 In ACM SIGPLAN International Conference on Functional Programming
, 1997
"... Tupling is a wellknown transformation tactic to obtain new efficient recursive functions by grouping some recursive functions into a tuple. It may be applied to eliminate multiple traversals over the common data structure. The major difficulty in tupling transformation is to find what functions are ..."
Abstract

Cited by 38 (20 self)
 Add to MetaCart
(Show Context)
Tupling is a wellknown transformation tactic to obtain new efficient recursive functions by grouping some recursive functions into a tuple. It may be applied to eliminate multiple traversals over the common data structure. The major difficulty in tupling transformation is to find what functions are to be tupled and how to transform the tupled function into an efficient one. Previous approaches to tupling transformation are essentially based on fold/unfold transformation. Though general, they suffer from the high cost of keeping track of function calls to avoid infinite unfolding, which prevents them from being used in a compiler. To remedy this situation, we propose a new method to expose recursive structures in recursive definitions and show how this structural information can be explored for calculating out efficient programs by means of tupling. Our new tupling calculation algorithm can eliminate most of multiple data traversals and is easy to be implemented. 1 Introduction Tupli...
A Calculational Fusion System HYLO
, 1997
"... Fusion, one of the most useful transformation tactics for deriving efficient programs, is the process whereby separate pieces of programs are fused into a single one, leading to an efficient program with no intermediate data structures produced. In this paper, we report our ongoing investigation on ..."
Abstract

Cited by 35 (10 self)
 Add to MetaCart
Fusion, one of the most useful transformation tactics for deriving efficient programs, is the process whereby separate pieces of programs are fused into a single one, leading to an efficient program with no intermediate data structures produced. In this paper, we report our ongoing investigation on the design and implementation of an automatic transformation system HYLO which performs fusion transformation in a more systematic and more general way than any other systems. The distinguished point of our system is its calculational feature based on simple application of transformation laws rather than traditional searchbased transformation.
Rewriting Haskell Strings
 In Practical Aspects of Declarative Languages 8th International Symposium, PADL 2007
, 2007
"... Abstract The Haskell String type is notoriously inefficient. We introduce a new data type, ByteString, based on lazy lists of byte arrays, combining the speed benefits of strict arrays with lazy evaluation. Equational transformations based on term rewriting are used to deforest intermediate ByteStri ..."
Abstract

Cited by 18 (6 self)
 Add to MetaCart
(Show Context)
Abstract The Haskell String type is notoriously inefficient. We introduce a new data type, ByteString, based on lazy lists of byte arrays, combining the speed benefits of strict arrays with lazy evaluation. Equational transformations based on term rewriting are used to deforest intermediate ByteStrings automatically. We describe novel fusion combinators with improved expressiveness and performance over previous functional array fusion strategies. A library for ByteStrings is implemented, providing a purely functional interface, which approaches the speed of lowlevel mutable arrays in C.