Learn More
Phantom types are data types with type constraints associated with different cases. Examples of phantom types include typed type representations and typed higher-order abstract syntax trees. These types can be used to support typed generic functions, dynamic typing, and staged compilation in higher-order, statically typed languages such as Haskell or(More)
Keywords ÈÖÓÓÖÖÑ ÖÖÚØØÓÒ¸ÑÓÒÒÒ׸ÑÓÒÒÒ ØÖÖÒ××ÓÖÑÑÖ׸¹ ØÖÖÖÒÒ¸ÙظÓÒØØÒÙÙØØÓÒ׸À××ÐиÈÖÓÐÓÓ Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the(More)
This paper explores the structure of red-black trees by solving an apparently simple problem: given an ascending sequence of elements, construct, in linear time, a red-black tree that contains the elements in symmetric order. Several extreme red-black tree shapes are characterized: trees of minimum and maximum height, trees with a minimal and with a maximal(More)
Number systems serve admirably as templates for container types: a container object of size n is modelled after the representation of the number n and operations on container objects are modelled after their number-theoretic counterparts. Binomial queues are probably the rst data structure that was designed with this analogy in mind. In this paper we show(More)
This paper describes a purely functional implementation of LR parsing. We formally derive our parsers in a series of steps starting from the inverse of printing. In contrast to traditional implementations of LR parsing, the resulting parsers are fully typed, stackless and table-free. The parsing functions pursue alternatives in parallel with each(More)
In this paper we discuss the surprisingly elegant interaction between two lines of rather independent research, namely generic (or polytypic) programming and dynamic types. We show how the two disciplines meet and emphasize their characteristics in the area of interactive programming as implemented in the functional language Clean. In this language, an(More)
Lists are ubiquitous in functional programming. The list constructor forms an instance of a monad capturing non-deterministic computations. Despite its popularity the list monad suffers from serious drawbacks: It relies in an essential way on lazy evaluation, it is inefficient , and it is not modular. We develop an alternative based on continuations, which(More)