Results 11  20
of
29
Value Recursion in Monadic Computations
 OGI School of Science and Engineering, OHSU
, 2002
"... viii 1 ..."
Implementing Fudgets with Standard Widget Sets
 In Glasgow Functional Programming Workshop
, 1998
"... Carlsson and Hallgren [1] describe the implementation of a set of "functional widgets" (Fudgets): components for programming graphical user interfaces under the X window system using the nonstrict functional programming language Haskell. We describe an alternative implementation based on existing wi ..."
Abstract

Cited by 10 (1 self)
 Add to MetaCart
Carlsson and Hallgren [1] describe the implementation of a set of "functional widgets" (Fudgets): components for programming graphical user interfaces under the X window system using the nonstrict functional programming language Haskell. We describe an alternative implementation based on existing widget sets (currently Openlook and Motif). Our purpose is twofold: to show that the Fudgets approach can be applied to existing widget sets; and to discuss problems experienced with Fudgets during an industrial case study. 1 Introduction Imperative language programmers enjoy relatively easy access to the graphics resources of workstations. The graphics hardware is manipulated by sideeffecting procedure calls. Even if the library of graphics procedures is written in one imperative language (e.g `C'), programs written in another imperative language can usually make calls to foreign procedures. For example, Ada allows foreign procedures to be called by giving a standard pragma. Ada compilers a...
Lazy DepthFirst Search and Linear Graph Algorithms in Haskell
 Glasgow Workshop on Functional Programming
, 1994
"... Depthfirst search is the key to a wide variety of graph algorithms. In this paper we explore the implementation of depth first search in a lazy functional language. For the first time in such languages we obtain a lineartime implementation. But we go further. Unlike traditional imperative presenta ..."
Abstract

Cited by 6 (0 self)
 Add to MetaCart
Depthfirst search is the key to a wide variety of graph algorithms. In this paper we explore the implementation of depth first search in a lazy functional language. For the first time in such languages we obtain a lineartime implementation. But we go further. Unlike traditional imperative presentations, algorithms are constructed from individual components, which may be reused to create new algorithms. Furthermore, the style of program is quite amenable to formal proof, which we exemplify through a calculationalstyle proof of a stronglyconnected components algorithm. 1 Introduction Graph algorithms have long been a challenge to programmers of lazy functional languages. It has not been at all clear how to express such algorithms without using side effects to achieve efficiency. For example, many texts provide implementations of search algorithms which are quadratic in the size of the graph (see Paulson (1991), Holyer (1991), or Harrison (1993)), compared with the standard linear im...
The Countdown Problem
 Journal of Functional Programming
, 2002
"... We systematically develop a functional program that solves the countdown problem, a numbers game in which the aim is to construct arithmetic expressions satisfying certain constraints. Starting from a formal specification of the problem, we present a simple but inefficient program that solves the pr ..."
Abstract

Cited by 5 (0 self)
 Add to MetaCart
We systematically develop a functional program that solves the countdown problem, a numbers game in which the aim is to construct arithmetic expressions satisfying certain constraints. Starting from a formal specification of the problem, we present a simple but inefficient program that solves the problem, and prove that this program is correct. We then use program fusion to calculate an equivalent but more efficient program, which is then further improved by exploiting arithmetic properties.
Functional Graph Algorithms with DepthFirst Search (Preliminary Summary)
 in Glasgow Functional Programming Workshop
, 1993
"... Performing a depthfirst search of a graph is one of the fundamental approaches for solving a variety of graph algorithms. Implementing depthfirst search efficiently in a pure functional language has only become possible with the advent of imperative functional programming. In this paper we mix the ..."
Abstract

Cited by 5 (0 self)
 Add to MetaCart
Performing a depthfirst search of a graph is one of the fundamental approaches for solving a variety of graph algorithms. Implementing depthfirst search efficiently in a pure functional language has only become possible with the advent of imperative functional programming. In this paper we mix the techniques of pure functional programming in the same cauldron as depthfirst search to yield a more lucid approach to viewing a variety of graph algorithms. This claim will be illustrated with several examples. 1 Introduction Graph algorithms have long been a challenge to functional programmers. It has not been at all clear how to express such algorithms without using side effects to achieve efficiency. For example, many texts provide implementations of search algorithms which are quadratic in the size of the graph (see [7, 3, 2], for instance), compared with the standard linear implementations given for imperative languages (see [1], for instance). In this paper we implement a variety of ...
Malloc Pointers and Stable Pointers: Improving Haskell's Foreign Language Interface
 In Glasgow Functional Programming Workshop Draft Proceedings
, 1994
"... The Glasgow Haskell compiler provides a foreign language interface which allows Haskell programs to call arbitrary C functions. This has been used both to implement the standard Haskell IO system and a variety of applications including an arcade game [8], and a graphical user interface to a database ..."
Abstract

Cited by 3 (1 self)
 Add to MetaCart
The Glasgow Haskell compiler provides a foreign language interface which allows Haskell programs to call arbitrary C functions. This has been used both to implement the standard Haskell IO system and a variety of applications including an arcade game [8], and a graphical user interface to a database [19]. The theoretical problems associated with using impure functions from pure functional languages are avoided through the use of monads [17]; and the mismatch between strict languages with no garbage collection and lazy languages with garbage collection is tackled by unboxing (that is, forcing evaluation of arguments and stripping off any header information) [15]. Whilst this works well for simple examples, it is unsuitable when one wants to pass arguments (or results) which are lazy, polymorphic or very large. We describe two extensions to the garbage collector which solve these problems by allowing better interaction between the Haskell garbage collector and memory allocation in the im...
The Vectorisation Monad
 PASCO'94: First International Symposium on Parallel Symbolic Computation
, 1994
"... : Traditionally a vectorising compiler matches the iterative constructs of a program against a set of predefined templates. If a loop contains no dependency cycles then a map template can be used; other simple dependencies can often be expressed in terms of fold or scan templates. This paper addre ..."
Abstract

Cited by 3 (2 self)
 Add to MetaCart
: Traditionally a vectorising compiler matches the iterative constructs of a program against a set of predefined templates. If a loop contains no dependency cycles then a map template can be used; other simple dependencies can often be expressed in terms of fold or scan templates. This paper addresses the template matching problem within the context of functional programming. A small collection of program identities are used to specify vectorisable forloops. By incorporating these program identities within a monad, all welltyped forloops in which the body of the loop is expressed using the vectorisation monad can be vectorised. This technique enables the elimination of template matching from a vectorising compiler, and the proof of the safety of vectorisation can be performed by a type inference mechanism. Keywords: Data parallelism; monads; vectorisation; BirdMeertens formalism; program transformation; category theory; imperative functional programming; nonstrict semantics; Has...
An Introduction to Category Theory, Category Theory Monads, and Their Relationship to Functional Programming
"... Incorporating imperative features into a purely functional language has become an active area of research within the functional programming community [10, 7, 12]. One of the techniques gaining widespread acceptance as a model for imperative functional programming is monads [13, 9]. The purpose of th ..."
Abstract

Cited by 2 (0 self)
 Add to MetaCart
Incorporating imperative features into a purely functional language has become an active area of research within the functional programming community [10, 7, 12]. One of the techniques gaining widespread acceptance as a model for imperative functional programming is monads [13, 9]. The purpose of this technical report is to give a category theoretic introduction to monads, and to explore the relationship to what functional programmers term a monad. Keywords: Monads; Category theory; Kleisli triple; Imperative functional programming. 1 Motivation This paper stems from the desire for an understanding of Moggi's work on the computational calculus and Monads [9, 8]. The presentation here owes much to the papers of Wadler [13, 14], and the basic texts on category theory [11, 1, 4, 6, 2]. 2 Basic category theory and monads Category theory is concerned with the observation that many of the properties from algebra can be simplified by a presentation in terms of diagrams containing arrows....
Expression Refinement: Deriving Bresenham's Algorithm
 Functional Programming: Glasgow 1994, SpringerVerlag Workshops in Computing
, 1994
"... This paper illustrates a method of transforming an initial specification expression, which is not necessarily algorithmic, into an efficient functional implementation using a refinement calculus for expressions. In doing this, we benefit from the ease of manipulation that stateless expressions ..."
Abstract

Cited by 1 (0 self)
 Add to MetaCart
This paper illustrates a method of transforming an initial specification expression, which is not necessarily algorithmic, into an efficient functional implementation using a refinement calculus for expressions. In doing this, we benefit from the ease of manipulation that stateless expressions allow. However, implementations of functional algorithms are not as cheap as imperative implementations. We further show how an imperative program can be derived from a functional expression using algebraic transformations based on the state monad model. The example used to illustrate the method is Bresenham's line drawing algorithm. 1 Introduction In this paper we show how a simple specification expression can be refined to an efficient functional program and then further transformed into an imperative program which is cheaper to implement than its functional equivalent. For the purpose of derivation, expressions are easier to manipulate than statements. This can be seen, for example...
Parallel Haskell: The vectorisation monad
, 1993
"... It has long been known that some of the most common uses of for and whileloops in imperative programs can easily be expressed using the standard higherorder functions fold and map. With this correspondence as a starting point, we derive parallel implementations of various iterative constructs, ea ..."
Abstract

Cited by 1 (0 self)
 Add to MetaCart
It has long been known that some of the most common uses of for and whileloops in imperative programs can easily be expressed using the standard higherorder functions fold and map. With this correspondence as a starting point, we derive parallel implementations of various iterative constructs, each having a better complexity than their sequential counterparts, and explore the use of monads to guarantee the soundness of the parallel implementation. As an aid to the presentation of the material, we use the proposed syntax for parallel Haskell [27] (figure 1) as a vehicle in which imperative functional programs will be expressed. Surprisingly, incorporating imperative features into a purely functional language has become an active area of research within the functional programming community [30, 24, 36, 20]. One of the techniques gaining widespread acceptance as a model for imperative functional programming is monads [38, 37, 26]. Typically monads are used to guarantee single threadedn...