• Corpus ID: 42852524

Stream fusion : practical shortcut fusion for coinductive sequence types

@inproceedings{Coutts2011StreamF,
  title={Stream fusion : practical shortcut fusion for coinductive sequence types},
  author={Duncan Coutts},
  year={2011}
}
In functional programming it is common practice to build modular programs by composing functions where the intermediate values are data structures such as lists or arrays. A desirable optimisation for programs written in this style is to fuse the composed functions and thereby eliminate the intermediate data structures and their associated runtime costs. Stream fusion is one such fusion optimisation that can eliminate intermediate data structures, including lists, arrays and other abstract data… 
The HERMIT in the stream: fusing stream fusion's concatMap
TLDR
A custom optimization plugin is developed which implements the proposed concatMap transformation, and a new translation scheme for list comprehensions which enables them to be optimized, and extends the transformation to monadic streams.
Haskell Beats C Using Generalized Stream Fusion
Stream fusion [3] is a powerful technique for automatically transforming high-level sequence-processing functions into efficient implementations. It has been used to great effect in Haskell libraries
Type-Based Cost Analysis for Lazy Functional Languages
TLDR
A type-based analysis employing amortisation and cost effects to statically determine upper bounds on evaluation costs of lazily evaluated functional languages, such as Haskell is applied.
Quoted staged rewriting: a practical approach to library-defined optimizations
TLDR
This work introduces Quoted Staged Rewriting (QSR), an approach that uses type-safe, pattern matching-enabled quasiquotes to define optimizations and renders library-defined optimizations more practical than ever before.
Fold-Based Fusion as a Library
TLDR
This paper presents an alternative approach, implementing fold-based fusion as a standalone library, using staging to compose operations on folds; the operations are partially evaluatedaway, yielding code that does not construct unnecessary inter-mediate data structures.
Call Arity
TLDR
Call Arity is an analysis that eta-expands functions based on their uses, instead of their definitions, and is very precise in the presence of recursion, which allows foldl-based combinators to take part in list fusion.
Fold-based fusion as a library: a generative programming pearl
TLDR
An alternative approach is presented, implementing fold-based fusion as a standalone library that uses staging to compose operations on folds, yielding code that does not construct unnecessary intermediate data structures.
Faster coroutine pipelines: A reconstruction
TLDR
Using the same derivation steps, this paper is able to derive a similar encoding for a more general setting, namely bidirectional pipes that is as performant as pipes, conduit, and streamly, which are other common Haskell stream processing libraries.
Programs for Cheap!
TLDR
The purpose of this paper is to explain these tricks to tell an optimization theorem that the operator satisfies, and give a proof of correctness for the optimisation, along with a formal guarantee about its effect on performance.
Deforestation
  • Sarah A. Boyle
  • The International Encyclopedia of Biological Anthropology
  • 2018
Deforestation occurs in many ways. Most of the clearing is done for agricultural purposes—grazing cattle, planting crops. Poor farmers chop down a small area (typically a few acres) and burn the tree
...
1
2
...

References

SHOWING 1-10 OF 71 REFERENCES
Short cut fusion is correct
TLDR
This paper shows that programs which have undergone short cut fusion are contextually equivalent to their unfused counterparts, and uses Pitts' recent demonstration that contextual equivalence in such languages is parametric to provide the first formal proof of the correctness ofShort cut fusion for them.
Warm fusion: deriving build-catas from recursive definitions
TLDR
This paper shows how to transform recursive programs into this form automatically, thus enabling the fusion transformation to reapplied more easily than before, and challenges compiler writers to decide how many passes their compiler should perform.
Stream fusion: from lists to streams to nothing at all
TLDR
An automatic deforestation system, stream fusion, based on equational transformations, that fuses a wider range of functions than existing short-cut fusion systems, and reimplemented the Haskell standard List library on top of this framework, providing stream fusion for Haskell lists.
Functional array fusion
TLDR
A novel form of combinator loop fusion, which by removing intermediate structures optimizes the use of the memory hierarchy, is discussed, which naturally generalizes to a parallel implementation and includes facilities for optimizing load balancing and communication.
Cheap deforestation for non-strict functional languages
TLDR
A new approach to deforestation is presented and one important conclusion is that a new analysis is required to infer function arities and the linearity of lambda abstractions that renders the basic deforestation algorithm far more effective.
Stream Fusion
  • B. Huffman
  • Computer Science
    Arch. Formal Proofs
  • 2009
TLDR
These theories contain a formalization of much of the Stream Fusion library in HOLCF, and lazy list and stream types are defined, along with coercions between the two types, as well as an equivalence relation for streams that generate the same list.
Lightweight fusion by fixed point promotion
TLDR
This paper proposes a lightweight fusion method for general recursive function definitions that fuses typical examples discussed in the literature and others that involve accumulating parameters, either in the tt foldl-like specific forms or in general recursive forms, without any additional machinery.
The Impact of seq on Free Theorems-Based Program Transformations
TLDR
This paper uses asymmetry introduced by left-closedness to derive criteria ensuring that both equational and inequational versions of short cut fusion and related program transformations based on free theorems hold in the presence of seq.
Chasing Bottoms: A Case Study in Program Verification in the Presence of Partial and Infinite Values
TLDR
This work describes a method for testing properties of programs in the presence of partial and infinite values and proves that the programs they have written are in fact (more or less) inverses using first fixpoint induction and then the approximation lemma.
Compact Fusion
TLDR
This paper explores the problem for the case when the intermediate structure is a list, and formalises the space behaviour of the solution by means of program transformation techniques and the use of abstract machines.
...
1
2
3
4
5
...