Results 1  10
of
23
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.
Tackling the awkward squad: monadic input/output, concurrency, exceptions, and foreignlanguage calls in Haskell
 Engineering theories of software construction
, 2001
"... Functional programming may be beautiful, but to write real applications we must grapple with awkward realworld issues: input/output, robustness, concurrency, and interfacing to programs written in other languages. These lecture notes give an overview of the techniques that have been developed by th ..."
Abstract

Cited by 97 (1 self)
 Add to MetaCart
Functional programming may be beautiful, but to write real applications we must grapple with awkward realworld issues: input/output, robustness, concurrency, and interfacing to programs written in other languages. These lecture notes give an overview of the techniques that have been developed by the Haskell community to address these problems. I introduce various proposed extensions to Haskell along the way, and I offer an operational semantics that explains what these extensions mean. This tutorial was given at the Marktoberdorf Summer School 2000. It will appears in the book “Engineering theories of software construction, Marktoberdorf Summer School 2000”, ed CAR Hoare, M Broy, and R Steinbrueggen, NATO ASI Series, IOS Press, 2001, pp4796. This version has a few errors corrected compared with the published version. Change summary: Apr 2005: some examples added to Section 5.2.2, to clarifyevaluate. March 2002: substantial revision 1
Parallel Programming using Functional Languages
, 1991
"... I am greatly indebted to Simon Peyton Jones, my supervisor, for his encouragement and technical assistance. His overwhelming enthusiasm was of great support to me. I particularly want to thank Simon and Geoff Burn for commenting on earlier drafts of this thesis. Through his excellent lecturing Cohn ..."
Abstract

Cited by 48 (3 self)
 Add to MetaCart
I am greatly indebted to Simon Peyton Jones, my supervisor, for his encouragement and technical assistance. His overwhelming enthusiasm was of great support to me. I particularly want to thank Simon and Geoff Burn for commenting on earlier drafts of this thesis. Through his excellent lecturing Cohn Runciman initiated my interest in functional programming. I am grateful to Phil Trinder for his simulator, on which mine is based, and Will Partain for his help with LaTex and graphs. I would like to thank the Science and Engineering Research Council of Great Britain for their financial support. Finally, I would like to thank Michelle, whose culinary skills supported me whilst I was writingup.The Imagination the only nation worth defending a nation without alienation a nation whose flag is invisible and whose borders are forever beyond the horizon a nation whose motto is why have one or the other when you can have one the other and both
A nondeterministic callbyneed lambda calculus
 INTERNATIONAL CONFERENCE ON FUNCTIONAL PROGRAMMING
, 1998
"... In this paper we present a nondeterministic callbyneed (untyped) lambda calculus nd with a constant choice and a letsyntax that models sharing. Our main result is that nd has the nice operational properties of the standard lambda calculus: confluence on sets of expressions, and normal order redu ..."
Abstract

Cited by 14 (7 self)
 Add to MetaCart
In this paper we present a nondeterministic callbyneed (untyped) lambda calculus nd with a constant choice and a letsyntax that models sharing. Our main result is that nd has the nice operational properties of the standard lambda calculus: confluence on sets of expressions, and normal order reduction is sufficient to reach head normal form. Using a strong contextual equivalence we show correctness of several program transformations. In particular of lambdalifting using deterministic maximal free expressions. These results show that nd is a new and also natural combination of nondeterminism and lambdacalculus, which has a lot of opportunities for parallel evaluation. An intended application of nd is as a foundation for compiling lazy functional programming languages with I/O based on direct calls. The set of correct program transformations can be rigorously distinguished from noncorrect ones. All program transformations are permitted with the slight exception that for transformations like common subexpression elimination and lambdalifting with maximal free expressions the involved subexpressions have to be deterministic ones.
Functional Quantum Programming
 In Proceedings of the 2nd Asian Workshop on Programming Languages and Systems
, 2001
"... It has been shown that nondeterminism, both angelic and demonic, can be encoded in a functional language in di#erent representation of sets. In this paper we see quantum programming as a special kind of nondeterministic programming where negative probabilities are allowed. ..."
Abstract

Cited by 9 (0 self)
 Add to MetaCart
It has been shown that nondeterminism, both angelic and demonic, can be encoded in a functional language in di#erent representation of sets. In this paper we see quantum programming as a special kind of nondeterministic programming where negative probabilities are allowed.
FUNDIO: A LambdaCalculus with a letrec, case, Constructors, and an IOInterface: Approaching a Theory of unsafePerformIO
, 2003
"... This paper proposes a nonstandard way to combine lazy functional languages with I/O. In order to demonstrate the usefulness of the approach, a tiny lazy functional core language “FUNDIO”, which is also a callbyneed lambda calculus, is investigated. The syntax of “FUNDIO ” has case, letrec, constr ..."
Abstract

Cited by 7 (0 self)
 Add to MetaCart
This paper proposes a nonstandard way to combine lazy functional languages with I/O. In order to demonstrate the usefulness of the approach, a tiny lazy functional core language “FUNDIO”, which is also a callbyneed lambda calculus, is investigated. The syntax of “FUNDIO ” has case, letrec, constructors and an IOinterface: its operational semantics is described by smallstep reductions. A contextual approximation and equivalence depending on the inputoutput behavior of normal order reduction sequences is defined and a context lemma is proved. This enables to study a semantics of “FUNDIO ” and its semantic properties. The paper demonstrates that the technique of complete reduction diagrams enables to show a considerable set of program transformations to be correct. Several optimizations of evaluation are given, including strictness optimizations and an abstract machine, and shown to be correct w.r.t. contextual equivalence. Correctness of strictness optimizations also justifies correctness of parallel evaluation.
Thus this calculus has a potential to integrate nonstrict functional programming with a nondeterministic approach to inputoutput and also to provide a useful semantics for this combination.
It is argued that monadic IO and unsafePerformIO can be combined in Haskell, and that the result is reliable, if all reductions and transformations are correct w.r.t. to the FUNDIOsemantics. Of course, we do not address the typing problems the are involved in the usage of Haskell’s
unsafePerformIO.
The semantics can also be used as a novel semantics for strict functional languages with IO, where the sequence of IOs is not fixed.
Unique Fixed Point Induction for McCarthy's Amb
 IN: PROCEEDINGS OF THE 24TH INTERNATIONAL SYMPOSIUM ON MATHEMATICAL FOUNDATIONS OF COMPUTER SCIENCE, ”LNCS” 1672
, 1999
"... We develop an operational theory of higherorder functions, recursion, and fair nondeterminism for a nontrivial, higherorder, callbyname functional programming language extended with McCarthy's amb. Implemented via fair parallel evaluation, functional programming with amb is very expressive. ..."
Abstract

Cited by 7 (2 self)
 Add to MetaCart
We develop an operational theory of higherorder functions, recursion, and fair nondeterminism for a nontrivial, higherorder, callbyname functional programming language extended with McCarthy's amb. Implemented via fair parallel evaluation, functional programming with amb is very expressive. However, conventional semantic fixed point principles for reasoning about recursion fail in the presence of fairness. Instead, we adapt higherorder operational methods to deal with fair nondeterminism. We present two natural semantics, describing mayand mustconvergence, and define a notion of contextual equivalence over these two modalities. The presence of amb raises special difficulties when reasoning about contextual equivalence. In particular, we report on a challenging open problem with regard to the validity of bisimulation proof methods. We develop two sound and useful reasoning methods which, in combination, enable us to prove a rich collection of laws for contextual...
Programming Reactive Systems in Haskell
, 1994
"... Certain classes of applications are naturally described as a network of cooperating components, where each component reacts to input as and when it becomes available. This paper builds on previous work on expressing I/O and statebased algorithms safely in a functional language, and presents a new w ..."
Abstract

Cited by 6 (0 self)
 Add to MetaCart
Certain classes of applications are naturally described as a network of cooperating components, where each component reacts to input as and when it becomes available. This paper builds on previous work on expressing I/O and statebased algorithms safely in a functional language, and presents a new way of expressing reactive systems in a functional language that does not violate vital semantic properties. The approach taken is a pragmatic one in that it integrates constructs for expressing reactive systems within existing framework for writing I/O bound, statebased programs functionally. The original contributions of this paper are twofold; first, we show how the existing monadic IO model can be extended to cope with nondeterminism, and secondly, we introduce primitives for evaluating I/O actions concurrently. 1 Introduction A large class of applications are naturally described as a collection of components cooperating to solve some task. Examples include operating systems and graphica...
Exploiting Purely Functional Programming to Obtain Bounded Resource Behaviour: the Hume Approach
 In Central European Summer School on Functional Programming
, 2005
"... Abstract. This chapter describes Hume: a functionallybased language for programming with bounded resource usage, including time and space properties. The purpose of the Hume language design is to explore the expressibility/costability spectrum in resourceconstrained systems, such as realtime embe ..."
Abstract

Cited by 6 (5 self)
 Add to MetaCart
Abstract. This chapter describes Hume: a functionallybased language for programming with bounded resource usage, including time and space properties. The purpose of the Hume language design is to explore the expressibility/costability spectrum in resourceconstrained systems, such as realtime embedded or control systems. It is unusual in being based on a combination of λcalculus and finite state machine notions, rather than the more usual propositional logic, or flat finitestatemachine models. The use of a strict, purely functional programming notation allows the construction of a strong cost model for expressions, which can then be embedded into a simple cost model for processes. In this chapter, we introduce Hume, describe the Hume Abstract Machine implementation, and show how a highlevel cost model can be constructed that relates costs from the abstract machine to Hume source programs. We illustrate our approach with an example adapted from the literature: a simple vending machine controller. 1
NonDeterminism Analysis in a ParallelFunctional Language
, 2000
"... . The paper presents several analyses to detect nondeterministic expressions in the parallelfunctional language Eden. First, the need for the analysis is motivated, and then each one is presented. The first one is typebased, while the other two are based on abstract interpretation. Their powe ..."
Abstract

Cited by 6 (4 self)
 Add to MetaCart
. The paper presents several analyses to detect nondeterministic expressions in the parallelfunctional language Eden. First, the need for the analysis is motivated, and then each one is presented. The first one is typebased, while the other two are based on abstract interpretation. Their power and efficiency is discussed, and an example is used to illustrate the differences. Two interesting functions to adapt abstract values to types appear, and they happen to be a Galois connection. 1 Introduction The paper presents several analyses to determine when an Eden [BLOMP96] expression is sure to be deterministic, and when it may be nondeterministic. The parallelfunctional language Eden extends the lazy functional language Haskell by constructs to explicitly define and communicate processes. The three main new concepts are process abstractions, process instantiations and the nondeterministic process abstraction merge. Process abstractions of type Process a b can be compared to ...