Results 11  20
of
30
Concurrent Monadic Interfacing
 10th International Workshop on the Implementation of Functional Languages (IFL '98), volume 1595 of LNCS
, 1998
"... . In this paper we present the Brisk 1 monadic framework, in which the usual monadic style of interfacing is adapted to accommodate a deterministic form of concurrency. Its main innovation is to allow actions on state components. This is a key issue which enables state splitting, a technique which ..."
Abstract

Cited by 11 (1 self)
 Add to MetaCart
. In this paper we present the Brisk 1 monadic framework, in which the usual monadic style of interfacing is adapted to accommodate a deterministic form of concurrency. Its main innovation is to allow actions on state components. This is a key issue which enables state splitting, a technique which assigns to each new thread a part of the state, a substate, to act upon. Distinct concurrent threads are restricted to access disjoint substates. A purely functional prototype implementation is presented to demonstrate these ideas. The resulting system acts as a basis for offering a purely functional form of concurrency, extending the expressiveness of functional languages without spoiling the semantics by introducing nondeterminism. 1 Introduction The use of monads has provided a new insight into the handling of stateful computations as state threads in the purely functional language Haskell [1]. The monadic approach has been further developed [8, 10] and incorporated into compilers su...
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 e ..."
Abstract

Cited by 10 (1 self)
 Add to MetaCart
(Show Context)
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...
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
(Show Context)
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
(Show Context)
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 ...
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
(Show Context)
: 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....
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 2 (1 self)
 Add to MetaCart
(Show Context)
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...
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
(Show Context)
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...
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...
Purity, Impurity and Efficiency in Graph Algorithms
"... Introduction This chapter initially considers pure lazy functional languages: their philosophy, advantages and disadvantages. We then examine how to develop efficient lazy functional programs. One way to achieve efficiency is to introduce impurities. In the final section the two schools of lazy fun ..."
Abstract
 Add to MetaCart
Introduction This chapter initially considers pure lazy functional languages: their philosophy, advantages and disadvantages. We then examine how to develop efficient lazy functional programs. One way to achieve efficiency is to introduce impurities. In the final section the two schools of lazy functional programming, pure and impure, are assessed. The assessment centres around two partial implementations of the Hopcroft Tarjan graph planarity algorithm. Profiling tools are used to make an experimental comparison and optimisation of each program. 4.1 Lazy Functional Programming In his book [42] Reade suggests that the user of a traditional imperative language is required to do the following: 1. describe the result to be computed; 2. impose an order on the steps required in the computation; 3. create and destroy, as required, any data structures used by the computation. 74 The first item is concerned with the extensional prope