## Polytypic Data Conversion Programs (2001)

Venue: | Science of Computer Programming |

Citations: | 25 - 9 self |

### BibTeX

@ARTICLE{Jansson01polytypicdata,

author = {Patrik Jansson and Johan Jeuring},

title = {Polytypic Data Conversion Programs},

journal = {Science of Computer Programming},

year = {2001},

volume = {43},

pages = {2002}

}

### Years of Citing Articles

### OpenURL

### Abstract

Several generic programs for converting values from regular datatypes to some other format, together with their corresponding inverses, are constructed. Among the formats considered are shape plus contents, compact bit streams and pretty printed strings. The different data conversion programs are constructed using John Hughes' arrow combinators along with a proof that printing (from a regular datatype to another format) followed by parsing (from that format back to the regular datatype) is the identity. The printers and parsers are described in PolyP, a polytypic extension of the functional language Haskell.

### Citations

616 |
Text compression
- Bell, Cleary, et al.
- 1990
(Show Context)
Citation Context ...uredsles to obtain faster transmission or fewer CDs. Structure-specic compression methods give much better compression results than conventional compression methods such as the Unix compress utility [=-=2,4-=-]. Structured compression is also used in heap compression and binary I/O [23]. The idea of designing structure-specic compression programs has been around since the beginning of the 1980s, but, as fa... |

458 | Comprehending Monads
- Wadler
- 1990
(Show Context)
Citation Context ... - = f >>> g 7 = 7 17 Many side effecting computations can be captured by the Arrow signature, including all functions returning monadic results: we can define a Kleisli arrow for every Haskell Monad =-=[22]-=-: data Kleisli m a b = Kleisli ( a - m b) instance Monad msArrow (Kleisli m) where art f -- Kleisli (Aa -- return (f a)) Kleisli f >>> Kleisli g = Kleisli (Aa -- f a : g) first (Kleisli f) -- Kleisli ... |

327 | Denotational Semantics: A Methodology for Language Development - Schmidt - 1986 |

178 | A system of constructor classes: overloading and implicit higher-order polymorphism
- Jones
- 1993
(Show Context)
Citation Context ... are (a) and (-*-). () "(a -- b) -- (a -- c) -- (a -- (b,c)) f a g = Ax-- (f x, g x) (-*-) "(a -- c) -- (b -- d) -- ((a,b) -- (c,d)) f - g = (fst;f) a (snd;g) We will often use Haskell's cla=-=ss system [16]-=- to write generic overloaded code. The type of an overloaded function has the form contextstype where context lists the class constraints the variables in the type must satisfy. An example is sort :: ... |

174 | PolyP – a polytypic programming language extension
- Jansson, Jeuring
- 1997
(Show Context)
Citation Context ...olytypic programming The data conversion functions constructed in this paper are polytypic functions. This section briefly introduces polytypic functions in the context of the Haskell extension Polyp =-=[11]-=-, and defines some basic polytypic concepts used in the paper. We assume that the reader is familiar with the initial algebra approach to datatypes [17], and not completely unfamiliar with polytypic p... |

160 | Generalising monads to arrows
- Hughes
- 2000
(Show Context)
Citation Context ...e size and complexity of the resulting programs considerably compared with our previous attempts. The conversion programs are expressed using arrows -- John Hughes' suggestion for generalizing monads =-=[9]-=-. The arrow combinators can be seen as defining a small (impure) functional language embedded in (pure) Haskell. We use constructor classes to allow for varying interpretations of this embedded langua... |

107 | Polytypic values possess polykinded types
- Hinze
- 2000
(Show Context)
Citation Context ...e = Bi (Bi (Leaf 1) (i (Leaf 7) (Leaf 3))) (Leaf S) can be represented by a pair of its shape treeShape :: Tree() treeShape -- Bin (Bin (Leaf ()) (Bin (Leaf ()) (Leaf ()))) (Leaf ()) and its contents =-=[1, 7, 3, 8]-=-. Our first data conversion program is a program separate for separating a value into its shape and its contents, together with its inverse: a program combine that combines a shape and some contents i... |

94 | A new approach to generic functional programming
- Hinze
- 2000
(Show Context)
Citation Context ...e = Bi (Bi (Leaf 1) (i (Leaf 7) (Leaf 3))) (Leaf S) can be represented by a pair of its shape treeShape :: Tree() treeShape -- Bin (Bin (Leaf ()) (Bin (Leaf ()) (Leaf ()))) (Leaf ()) and its contents =-=[1, 7, 3, 8]-=-. Our first data conversion program is a program separate for separating a value into its shape and its contents, together with its inverse: a program combine that combines a shape and some contents i... |

84 | Generic programming – an introduction - Backhouse, Jansson, et al. - 1999 |

60 | A semantics for shape
- Jay
- 1995
(Show Context)
Citation Context ...ytypic [15] programs: programs that work uniformly for large classes of datatypes. The construction proves that the two functions are each others' inverses. Note that shapes are at the heart of Jay's =-=[14]-=- theory of polytypism, but here we only use separate and combine as examples of simple data conversion programs. 1.1.2 Traversals. When working with structured data, one often performs operations on a... |

41 | Calculate polytypically
- Meertens
- 1996
(Show Context)
Citation Context ... We have presented a few calculations of polytypic programs. We think that calculating with polytypic functions is still rather cumbersome, and we hope to obtain more theory, in the style of Meertens =-=[18]-=- and Hinze [8], to simplify calculations with polytypic programs. If we take Hinze's approach to polytypic programming [7], then we only have 4 constructors for pattern functors instead of 7, and this... |

40 | A generic programming extension for Haskell
- Hinze
- 1999
(Show Context)
Citation Context ...ed polytypic programs for several data conversion problems. As far as we are aware, these are the first implemented generic descriptions of programs for data conversion problems. Recent work by Hinze =-=[6]-=- also contains a polytypic show function and a simple packing function, but his language still lacks an implementation. For each of the data conversion problems considered in this paper we construct a... |

37 |
Source encoding using syntactic information source models
- Cameron
- 1988
(Show Context)
Citation Context ...d files to obtain faster transmission or fewer CDs. Structure-specific compression methods give much better compression results than conventional compression methods such as the Unix compress utility =-=[2, 4]-=-. Structured compression is also used in heap compression and binary I/O [23]. The idea of designing structure-specific compression programs has been around since the beginning of the 1980s, but for m... |

37 |
Algebraic Specification of Data Types: A Synthetic Approach
- Lehmann, Smyth
- 1981
(Show Context)
Citation Context ...s in the context of the Haskell extension Polyp [11], and defines some basic polytypic concepts used in the paper. We assume that the reader is familiar with the initial algebra approach to datatypes =-=[17]-=-, and not completely unfamiliar with polytypic programming. For an introduction to polytypic programming, see [1]. 2.1 Notation We use Haskell [20] notation with a few exceptions for notational conven... |

28 | Polytypic pattern matching
- Jeuring
- 1995
(Show Context)
Citation Context ...parate for separating a value into its shape and its contents, together with its inverse: a program combine that combines a shape and some contents into a datatype value. These programs are polytypic =-=[15]-=- programs: programs that work uniformly for large classes of datatypes. The construction proves that the two functions are each others' inverses. Note that shapes are at the heart of Jay's [14] theory... |

22 | Polytypic compact printing and parsing
- JANSSON, JEURING
- 1999
(Show Context)
Citation Context ...program. The uncompression program is similarly composed of a polytypic unpacker and a polytypic pretty printer. The first implemented generic description of a packing program was in our earlier work =-=[12]-=-. Our packing algorithm compresses data by compactly representing the structure of the data using only static information -- the type of the data. Traditional (bit stream) compressors that use dynamic... |

7 | Heap compression and binary I/O in Haskell
- Wallace, Runciman
- 1997
(Show Context)
Citation Context ...ion methods give much better compression results than conventional compression methods such as the Unix compress utility [2, 4]. Structured compression is also used in heap compression and binary I/O =-=[23]-=-. The idea of designing structure-specific compression programs has been around since the beginning of the 1980s, but for many years only example instantiations appeared in the literature. This paper ... |

6 |
The WWW home page for polytypic programming. Available from http://www.cs.chalmers.se/~patrikj/poly
- Jansson
- 2003
(Show Context)
Citation Context ... their inverses;sshow how to construct and calculate with polytypic functions. The implementation of the data conversion programs as Polyp code can be obtained from the polytypic programming WWW page =-=[13]-=-. The rest of this paper is organized as follows. Section 2 briefly introduces polytypic programming. Section 3 constructs polytypic programs for separating a datatype value into its shape and its con... |

5 | The calculation of a polytypic parser
- Huisman
- 1996
(Show Context)
Citation Context ...the inverse function requirement rigorously in the construction of the programs, the size and the complexity of the code have been reduced considerably. Compare for example BjSrk's [3] and Huisman 's =-=[10]-=- definitions, with the polytypic read and show functions defined in this paper. We firmly believe that such a rigorous approach is the only way to obtain elegant solutions to involved polytypic proble... |

4 |
Algebraic speci of data types: a synthetic approach
- Lehmann, Smyth
- 1981
(Show Context)
Citation Context ...ns in the context of the Haskell extension PolyP [11], and denes some basic polytypic concepts used in the paper. We assume that the reader is familiar with the initial algebra approach to datatypes [=-=16]-=-, and not completely unfamiliar with polytypic programming. For an introduction to polytypic programming, see [1]. 2.1 Notation We use Haskell [20] notation with a few exception for notational conveni... |

1 | Comparing approaches to polytypic programming
- Halenbeek
- 1998
(Show Context)
Citation Context ...s. In our first attempts to polytypic programs for packing and unpacking we used monads instead of arrows. Although it is possible to construct the (un)packing func44 tions with monads (see Halenbeek =-=[5]-=-), the inverse function construction, and hence the correctness proof, is simpler with arrows. Loosely speaking, arrows are more easily inverted as input and output are handled symmetrically. We have ... |

1 |
Embedding a class of domain-specific languages in a functional language. Available from http://www. soi. city. ac. uk/~ross/papers
- Paterson
- 2000
(Show Context)
Citation Context ...rarchy of arrow classes as embedded domain specific languages for expressing data conversion programs. For additional motivation and background for using arrows, see the papers by Hughes and Paterson =-=[9, 19]-=-. Basic definitions and laws for arrows To define the arrow maps and to prove (a generalization of) Law (1), we need a few combinators to construct and combine arrows, together with some laws that rel... |

1 |
pretty printers and PolyP
- Parsers
- 1997
(Show Context)
Citation Context ...Bin (Bin (Leaf 1) (Bin (Leaf 7) (Leaf 3))) (Leaf 8) can be represented by a pair of its shape treeShape :: Tree () treeShape = Bin (Bin (Leaf ()) (Bin (Leaf ()) (Leaf ()))) (Leaf ()) and its contents =-=[1; 7; 3; 8]-=-. Oursrst data conversion program is a program separate for separating a value into its shape and its contents, together with its inverse: a program combine that combines a shape and some contents int... |

1 | General arrow constructions - Paterson - 1999 |

1 |
Embedding a class of domain-speci languages in a functional language
- Paterson
- 2000
(Show Context)
Citation Context ...tion generalizes the type constructor SA s to Hughes' abstract class for arrows [9]. The arrow class can be seen as a minimal signature of an embedded domain specic language as described by Paterson [=-=19-=-]. For additional motivation and background for using arrows, see the papers by Hughes and Paterson [9, 19]. We use a hierarchy of arrow classes as embedded domain specic languages for expressing data... |