#### DMCA

## This work is licensed under the Creative Commons Attribution License. Parametric Compositional Data Types

### Citations

460 | Deforestation: Transforming Programs to Eliminate Trees.” In: - Wadler - 1988 |

355 | Higher-order abstract syntax
- Pfenning, Elliott
(Show Context)
Citation Context ...ssues like computations modulo α-equivalence and capture-avoiding substitutions. The work we present in this paper fills that gap by adopting (a restricted form of) higherorder abstract syntax (HOAS) =-=[15]-=-, which uses the host language’s variable binding mechanism to represent binders in the object language. Since implementing efficient recursion schemes in the presence of HOAS is challenging [8, 13, 1... |

99 | FreshML: programming with binders made simple.
- Shinwell, Pitts, et al.
- 2003
(Show Context)
Citation Context ...re explicit, but recursively defined functions are guaranteed to be invariant with respect to α-equivalence of terms. Implementations of this approach, however, require extensions of the metalanguage =-=[21]-=-, and the approach is therefore not immediately usable in Haskell. Acknowledgement The authors wish to thank Andrzej Filinski for his insightful comments on an earlier version of this paper. Reference... |

98 | Bananas in Space: Extending Fold and Unfold to Exponential Types
- Meijer, Hutton
- 1995
(Show Context)
Citation Context ...OAS) [15], which uses the host language’s variable binding mechanism to represent binders in the object language. Since implementing efficient recursion schemes in the presence of HOAS is challenging =-=[8, 13, 19, 25]-=-, integrating this technique with CDTs is a non-trivial task. Following a brief introduction to CDTs in Section 2, we describe how to achieve this integration as follows: 4 Parametric Compositional Da... |

60 | Revisiting catamorphisms over datatypes with embedded functions (or, programs from outer space
- Fegaras, Sheard
- 1996
(Show Context)
Citation Context ...OAS) [15], which uses the host language’s variable binding mechanism to represent binders in the object language. Since implementing efficient recursion schemes in the presence of HOAS is challenging =-=[8, 13, 19, 25]-=-, integrating this technique with CDTs is a non-trivial task. Following a brief introduction to CDTs in Section 2, we describe how to achieve this integration as follows: 4 Parametric Compositional Da... |

56 | Alpha-structural recursion and induction
- Pitts
(Show Context)
Citation Context ... make the interpreter fully modular by also using a PCDT for the return type, and using a multi-parameter type class definition similar to the desugaring transformation in Section 3.2.3. Nominal sets =-=[16]-=- is another approach for dealing with binders, in which variables are explicit, but recursively defined functions are guaranteed to be invariant with respect to α-equivalence of terms. Implementations... |

45 | Boxes go bananas: Encoding higher-order abstract syntax with parametric polymorphism
- Washburn, Weirich
- 2003
(Show Context)
Citation Context ...OAS) [15], which uses the host language’s variable binding mechanism to represent binders in the object language. Since implementing efficient recursion schemes in the presence of HOAS is challenging =-=[8, 13, 19, 25]-=-, integrating this technique with CDTs is a non-trivial task. Following a brief introduction to CDTs in Section 2, we describe how to achieve this integration as follows: 4 Parametric Compositional Da... |

20 | Monadic Maps and Folds for Arbitrary Datatypes - Fokkinga - 1994 |

16 |
Rémi Gilleron, Christof Löding, Florent Jacquemard, Denis Lugiez, Sophie Tison, and Marc Tommasi. Available online since 1997: http://tata.gforge.inria.fr
- Comon, Dauchet
- 2007
(Show Context)
Citation Context ...s and histomorphisms. Moreover, term homomorphisms can be straightforwardly extended with a state space: depending on how the state is propagated, this yields bottom-up resp. topdown tree transducers =-=[7]-=-. Our approach of using PHOAS [6] amounts to the same restriction on embedded functions as Fegeras and Sheard [8], and Washburn and Weirich [25]. However, unlike Washburn and Weirich’s Haskell impleme... |

9 | 2010 Language Report
- Marlow, ed
- 2010
(Show Context)
Citation Context ...al data types are available as a Haskell library1, including numerous examples that are not included in this paper. All code fragments presented throughout the paper are written in (literate) Haskell =-=[11]-=-, and the library relies on several language extensions that are currently only known to be supported by the Glasgow Haskell Compiler (GHC). 2 Compositional Data Types Based on Swierstra’s data types ... |

6 |
Oleg Kiselyov & Chung chieh Shan (2009): Finally tagless, partially evaluated: Tagless staged interpreters for simpler typed languages
- Carette
(Show Context)
Citation Context ...ed termination properties of our histomorphisms, we conjecture that the use of our parametric terms—which are purely inductive—may provide one solution. The finally tagless approach of Carette et al. =-=[5]-=- has been proposed as an alternative solution to the expression problem [24]. While the approach is very simple and elegant, and also supports (typed) higher-order encodings, the approach falls short ... |

5 |
The expression problem. http://homepages.inf.ed.ac.uk/wadler
- Wadler
- 1998
(Show Context)
Citation Context ...oal [. . . ] to define a datatype by cases, where one can add new cases to the datatype and new functions over the datatype, without recompiling existing code, and while retaining static type safety” =-=[24]-=-. Swierstra [22] elegantly addressed this problem using Haskell and its type classes machinery. While Swierstra’s approach exhibits invaluable simplicity and clarity, it lacks features necessary to ap... |

4 |
Maarten Fokkinga & Ross Paterson (1991): Functional programming with bananas, lenses, envelopes and barbed wire
- Meijer
(Show Context)
Citation Context ... to duplicate common constructors, and without having to give up on statically guaranteed invariants about the structure of the ASTs. CDTs take the viewpoint of data types as fixed points of functors =-=[12]-=-, i.e. the definition of the AST data type is separated into non-recursive signatures (functors) on the one hand and the recursive structure on the other hand. For our example, we define the following... |

4 |
2002) Template meta-programming for Haskell
- Sheard, Jones, et al.
(Show Context)
Citation Context ...the CDTs library provides all the generic functionality as well as automatic derivation of boilerplate code. With (generalised) PCDTs we have followed that path. Our library provides Template Haskell =-=[20]-=- code to automatically derive instances of the required type classes, such as Difunctor and Ditraversable, as well as smart constructors and lifting of algebra type classes to coproducts. Moreover, ou... |

3 |
A hierarchy of mendler style recursion combinators: taming inductive datatypes with negative occurrences
- Ahn, Sheard
- 2011
(Show Context)
Citation Context ...t, we sometimes need to inspect terms in order to write functions that produce terms, such as our constant folding algorithm. With Washburn and Weirich’s encoding this is not possible. Ahn and Sheard =-=[1]-=- recently showed how to generalise the recursion schemes of Washburn and Weirich to Mendler-style recursion schemes, using the same representation for terms as Washburn and Weirich. Hence their approa... |

2 |
Atkey (2009): Syntax for Free: Representing Syntax with Binding Using Parametricity
- Robert
(Show Context)
Citation Context ...finition of LTerm guarantees that all functions embedded via Lam are parametric, and likewise that Var—Fegaras and Sheard’s Place—can only be applied to variables bound by an embedded function. Atkey =-=[2]-=- showed that the encoding above adequately captures closed lambda terms modulo αequivalence, assuming that there is no infinite data and that all embedded functions are total. 3.2.1 Parametric Terms I... |

2 |
Lindley & Jeremy Yallop (2009): Unembedding Domain-Specific Languages
- Atkey, Sam
(Show Context)
Citation Context ...ry simple and elegant, and also supports (typed) higher-order encodings, the approach falls short when we want to define recursive, modular computations that construct modular terms too. Atkey et al. =-=[3]-=-, for instance, use the finally tagless approach to build a modular interpreter. However, the interpreter cannot be made modular in the return type, i.e. the language defining values. Hence, when Atke... |

2 |
Hvitved (2011): Compositional Data Types
- Bahr, Tom
(Show Context)
Citation Context ...ity and clarity, it lacks features necessary to apply it in a practical setting beyond the confined simplicity of the expression problem. To this end, the framework of compositional data types (CDTs) =-=[4]-=- provides a rich library for implementing practical functionality on highly modular data types. This includes support of a wide array of recursion schemes in both pure and monadic forms, as well as mu... |

2 |
Chlipala (2008): Parametric Higher-Order Abstract Syntax for Mechanized Semantics
- Adam
(Show Context)
Citation Context ...ing a brief introduction to CDTs in Section 2, we describe how to achieve this integration as follows: 4 Parametric Compositional Data Types • We adopt parametric higher-order abstract syntax (PHOAS) =-=[6]-=-, and we show how to capture this restricted form of HOAS via difunctors. The thus obtained parametric compositional data types (PCDTs) allow for the definition of modular catamorphisms à la Fegaras ... |

2 |
Ghani (2008): Foundations for Structured Programming with GADTs
- Johann, Neil
(Show Context)
Citation Context ...se and opportunity for deforestation [23] that we know from CDTs (Section 5). • We show how to represent mutually recursive data types and GADTs by generalising PCDTs in the style of Johann and Ghani =-=[10]-=- (Section 6). • We illustrate the practical applicability of our framework by means of a complete library example, and we show how to automatically derive functionality for deciding equality (Section ... |

2 |
Tolmach & Tony Hoare (2001): Playing by the Rules: Rewriting as a practical optimisation technique
- Jones, Andrew
(Show Context)
Citation Context ...tactic sugar, rather than composing eval and desug, we can use the function cata (φEvalρDesug), which only traverses the term once. This transformation can be automated using GHC’s rewrite mechanism =-=[14]-=- and our experimental results for CDTs show that the thus obtained speedup is significant [4]. 6 Generalised Parametric Compositional Data Types In this section we briefly describe how to lift the con... |

2 |
Chakravarty & Martin Sulzmann (2008): Type Checking with Open Type Functions
- Schrijvers, Jones, et al.
(Show Context)
Citation Context ...at, for a given object language type constructed from TArrow and TInt, selects the corresponding subset of the semantic domain Sem m from Section 4.1. This can be achieved via Haskell’s type families =-=[17]-=-: type family Sem (m ::∗→ ∗) i type instance Sem m (i ‘TArrow‘ j) = Sem m i→ m (Sem m j) type instance Sem m TInt = Int The type Sem m t is obtained from an object language type t by replacing each fu... |

2 |
Sulzmann & Dimitrios Vytiniotis (2009): Complete and Decidable Type Inference for GADTs
- Schrijvers, Jones, et al.
(Show Context)
Citation Context ...ly modular data types. This includes support of a wide array of recursion schemes in both pure and monadic forms, as well as mutually recursive data types and generalised algebraic data types (GADTs) =-=[18]-=-. What CDTs fail to address, however, is a transparent representation of variable binders that frees the programmer’s mind from common issues like computations modulo α-equivalence and capture-avoidin... |

2 |
Joëlle Despeyroux & Frank Pfenning (2001): Primitive recursion for higher-order abstract syntax
- Schürmann
(Show Context)
Citation Context |