Results 1 
4 of
4
Comprehending Monads
 Mathematical Structures in Computer Science
, 1992
"... Category theorists invented monads in the 1960's to concisely express certain aspects of universal algebra. Functional programmers invented list comprehensions in the 1970's to concisely express certain programs involving lists. This paper shows how list comprehensions may be generalised to an arbit ..."
Abstract

Cited by 456 (13 self)
 Add to MetaCart
Category theorists invented monads in the 1960's to concisely express certain aspects of universal algebra. Functional programmers invented list comprehensions in the 1970's to concisely express certain programs involving lists. This paper shows how list comprehensions may be generalised to an arbitrary monad, and how the resulting programming feature can concisely express in a pure functional language some programs that manipulate state, handle exceptions, parse text, or invoke continuations. A new solution to the old problem of destructive array update is also presented. No knowledge of category theory is assumed.
Deforestation: Transforming programs to eliminate trees
 Theoretical Computer Science
, 1990
"... An algorithm that transforms programs to eliminate intermediate trees is presented. The algorithm applies to any term containing only functions with definitions in a given syntactic form, and is suitable for incorporation in an optimising compiler. Intermediate listsand, more generally, interm ..."
Abstract

Cited by 403 (5 self)
 Add to MetaCart
An algorithm that transforms programs to eliminate intermediate trees is presented. The algorithm applies to any term containing only functions with definitions in a given syntactic form, and is suitable for incorporation in an optimising compiler. Intermediate listsand, more generally, intermediate treesare both the basis and the bane of a certain style of programming in functional languages. For example, to compute the sum of the squares of the numbers from 1 to n, one could write the following program: sum (map square (upto 1 n)) (1) A key feature of this style is the use of functions (upto, map, sum) to encapsulate common patterns of computation ("consider the numbers from 1 to n ", "apply a function to each element", "sum a collection of elements"). Intermediate lists are the basis of this stylethey are the glue that holds the functions together. In this case, the list [1; 2; : : : ; n] connects upto to map, and the list [1; 4; : : : ; n 2 ] connects map to sum. B...
Decomposing Typed Lambda Calculus Into a Couple of Categorical Programming Languages
 Proc. CTCS , Lect. Notes in Computer Science 953
, 1995
"... . We give two categorical programming languages with variable arrows and associated abstraction/reduction mechanisms, which extend the possibility of categorical programming [Hag87, CF92] in practice. These languages are complementary to each other  one of them provides a firstorder programming s ..."
Abstract

Cited by 8 (0 self)
 Add to MetaCart
. We give two categorical programming languages with variable arrows and associated abstraction/reduction mechanisms, which extend the possibility of categorical programming [Hag87, CF92] in practice. These languages are complementary to each other  one of them provides a firstorder programming style whereas the other does higherorder  and are "children" of the simply typed lambda calculus in the sense that we can decompose typed lambda calculus into them and, conversely, the combination of them is equivalent to typed lambda calculus. This decomposition is a consequence of a semantic analysis on typed lambda calculus due to C. Hermida and B. Jacobs [HJ94]. 1 Introduction There have been several attempts applying category theory to designing programming languages directly, especially to typed functional programming languages, since category theory itself has been a typed functional language for various mathematics. If one (possibly a programmer or a mathematician) can regard a cat...
Logic Programming with Monads and Comprehensions
"... We give a logical reconstruction of allsolution predicates in terms of list comprehensions in Prolog's and we describe a variety of logic programming constructs in terms of monads and monad morphisms. Novel monad structures are described for lazy function lists, clause unfoldings and a monad mo ..."
Abstract
 Add to MetaCart
We give a logical reconstruction of allsolution predicates in terms of list comprehensions in Prolog's and we describe a variety of logic programming constructs in terms of monads and monad morphisms. Novel monad structures are described for lazy function lists, clause unfoldings and a monad morphism based embedding of Prolog in Prolog is given. Keywords: computing paradigms, logic programming, monads, list comprehensions, all solution predicates, Prolog, higherorder unification, lazy function lists. 1 Introduction Monads and comprehensions, have been successfully used in functional programming as a convenient generalization of various structurally similar programming constructs starting with simple ones like list processing and ending with intricate ones like CPS transformations and state transformers. We refer to the work of Philip Wadler [16, 17] for a long list of powerful examples and to Moggi [10] for the categorist sources of the concept of monad. Allsolution predic...