Results 1  10
of
22
Applicative programming with effects
 Journal of Functional Programming
"... In this paper, we introduce Applicative functors—an abstract characterisation of an applicative style of effectful programming, weaker than Monads and hence more widespread. Indeed, it is the ubiquity of this programming pattern that drew us to the abstraction. We retrace our steps in this paper, in ..."
Abstract

Cited by 68 (4 self)
 Add to MetaCart
In this paper, we introduce Applicative functors—an abstract characterisation of an applicative style of effectful programming, weaker than Monads and hence more widespread. Indeed, it is the ubiquity of this programming pattern that drew us to the abstraction. We retrace our steps in this paper, introducing the applicative pattern by diverse examples, then abstracting it to define the Applicative type class and introducing a bracket notation which interprets the normal application syntax in the idiom of an Applicative functor. Further, we develop the properties of applicative functors and the generic operations they support. We close by identifying the categorical structure of applicative functors and examining their relationship both with Monads and with Arrows. 1
Recursive Monadic Bindings
, 2000
"... Monads have become a popular tool for dealing with computational effects in Haskell for two significant reasons: equational reasoning is retained even in the presence of effects; and program modularity is enhanced by hiding "plumbing" issues inside the monadic infrastructure. Unfortunately, not all ..."
Abstract

Cited by 43 (4 self)
 Add to MetaCart
Monads have become a popular tool for dealing with computational effects in Haskell for two significant reasons: equational reasoning is retained even in the presence of effects; and program modularity is enhanced by hiding "plumbing" issues inside the monadic infrastructure. Unfortunately, not all the facilities provided by the underlying language are readily available for monadic computations. In particular, while recursive monadic computations can be defined directly using Haskell's builtin recursion capabilities, there is no natural way to express recursion over the values of monadic actions. Using examples, we illustrate why this is a problem, and we propose an extension to Haskell's donotation to remedy the situation. It turns out that the structure of monadic valuerecursion depends on the structure of the underlying monad. We propose an axiomatization of the recursion operation and provide a catalogue of definitions that satisfy our criteria.
Parsing Permutation Phrases
, 2001
"... A permutation phrase is a sequence of elements (possibly of di#erent types) in which each element occurs exactly once and the order is irrelevant. Some of the permutable elements may be optional. We show a way to extend a parser combinator library with support for parsing such freeorder constructs. ..."
Abstract

Cited by 20 (2 self)
 Add to MetaCart
A permutation phrase is a sequence of elements (possibly of di#erent types) in which each element occurs exactly once and the order is irrelevant. Some of the permutable elements may be optional. We show a way to extend a parser combinator library with support for parsing such freeorder constructs. A user of the library can easily write parsers for permutation phrases and does not need to care about checking and reordering the recognised elements. Possible applications include the generation of parsers for attributes of XML tags and Haskell's record syntax.
Structuring quantum effects: Superoperators as arrows
 Mathematical Structures in Computer Science, special issue on Quantum Programming Languages
, 2006
"... We show that quantum computation can be decomposed in a pure classical (functional) part and an effectful part modeling probabilities and measurement. The effectful part can be modeled using a generalization of monads called arrows. Both the functional and effectful parts can be elegantly expressed ..."
Abstract

Cited by 16 (8 self)
 Add to MetaCart
We show that quantum computation can be decomposed in a pure classical (functional) part and an effectful part modeling probabilities and measurement. The effectful part can be modeled using a generalization of monads called arrows. Both the functional and effectful parts can be elegantly expressed in the Haskell programming language. 1
Arrows, like monads, are monoids
 Proc. of 22nd Ann. Conf. on Mathematical Foundations of Programming Semantics, MFPS XXII, v. 158 of Electron. Notes in Theoret. Comput. Sci
, 2006
"... Monads are by now wellestablished as programming construct in functional languages. Recently, the notion of “Arrow ” was introduced by Hughes as an extension, not with one, but with two type parameters. At first, these Arrows may look somewhat arbitrary. Here we show that they are categorically fai ..."
Abstract

Cited by 12 (1 self)
 Add to MetaCart
Monads are by now wellestablished as programming construct in functional languages. Recently, the notion of “Arrow ” was introduced by Hughes as an extension, not with one, but with two type parameters. At first, these Arrows may look somewhat arbitrary. Here we show that they are categorically fairly civilised, by showing that they correspond to monoids in suitable subcategories of bifunctors C op ×C → C. This shows that, at a suitable level of abstraction, arrows are like monads — which are monoids in categories of functors C → C. Freyd categories have been introduced by Power and Robinson to model computational effects, well before Hughes ’ Arrows appeared. It is often claimed (informally) that Arrows are simply Freyd categories. We shall make this claim precise by showing how monoids in categories of bifunctors exactly correspond to Freyd categories.
Safe Functional Reactive Programming through Dependent Types
"... Functional Reactive Programming (FRP) is an approach to reactive programming where systems are structured as networks of functions operating on signals. FRP is based on the synchronous dataflow paradigm and supports both continuoustime and discretetime signals (hybrid systems). What sets FRP apart ..."
Abstract

Cited by 10 (0 self)
 Add to MetaCart
Functional Reactive Programming (FRP) is an approach to reactive programming where systems are structured as networks of functions operating on signals. FRP is based on the synchronous dataflow paradigm and supports both continuoustime and discretetime signals (hybrid systems). What sets FRP apart from most other languages for similar applications is its support for systems with dynamic structure and for higherorder reactive constructs. Statically guaranteeing correctness properties of programs is an attractive proposition. This is true in particular for typical application domains for reactive programming such as embedded systems. To that end, many existing reactive languages have type systems or other static checks that guarantee domainspecific properties, such as feedback loops always being wellformed. However, they are limited in their capabilities to support dynamism and higherorder dataflow compared with FRP. Thus, the onus of ensuring such properties of FRP programs has so far been on the programmer as established static techniques do not suffice. In this paper, we show how dependent types allow this concern to be addressed. We present an implementation of FRP embedded in the dependentlytyped language Agda, leveraging the type system of the host language to craft a domainspecific (dependent) type system for FRP. The implementation constitutes a discrete, operational semantics of FRP, and as it passes the Agda type, coverage, and termination checks, we know the operational semantics is total, which means our type system is safe. Categories and Subject Descriptors D.3.2 [Programming Languages]: Language Classifications—applicative (functional) languages, dataflow languages, specialized application languages General Terms Languages Keywords dependent types, domainspecific languages, DSELs, FRP, functional programming, reactive programming, synchronous dataflow
The arrow calculus
, 2008
"... Abstract. We introduce the arrow calculus, a metalanguage for manipulating Hughes’s arrows with close relations both to Moggi’s metalanguage for monads and to Paterson’s arrow notation. Arrows are classically defined by extending lambda calculus with three constructs satisfying nine (somewhat idiosy ..."
Abstract

Cited by 7 (3 self)
 Add to MetaCart
Abstract. We introduce the arrow calculus, a metalanguage for manipulating Hughes’s arrows with close relations both to Moggi’s metalanguage for monads and to Paterson’s arrow notation. Arrows are classically defined by extending lambda calculus with three constructs satisfying nine (somewhat idiosyncratic) laws. In contrast, the arrow calculus adds four constructs satisfying five laws. Two of the constructs are arrow abstraction and application (satisfying beta and eta laws) and two correspond to unit and bind for monads (satisfying left unit, right unit, and associativity laws). The five laws were previously known to be sound; we show that they are also complete, and hence that the five laws may replace the nine. We give a translation from classic arrows into the arrow calculus to complement Paterson’s desugaring and show that the two translations form an equational correspondence in the sense of Sabry and Felleisen. We are also the first to publish formal type rules (which are unusual in that they require two contexts), which greatly aided our understanding of arrows. The first fruit of our new calculus is to reveal some redundancies in the classic formulation: the nine classic arrow laws can be reduced to eight, and the three additional classic arrow laws for arrows with apply can be reduced to two. The calculus has also been used to clarify the relationship between idioms, arrows and monads and as the inspiration for a categorical semantics of arrows. 1
Parallel Parsing Processes
 J. FUNCTIONAL PROGRAMMING
"... We derive a combinator library for nondeterministic parsers with a monadic interface. The choice operator is implemented as a breadthfirst search rather than the more common depthfirst search, and can be seen as a parallel composition between two parsing processes. The resulting library is simple ..."
Abstract

Cited by 6 (0 self)
 Add to MetaCart
We derive a combinator library for nondeterministic parsers with a monadic interface. The choice operator is implemented as a breadthfirst search rather than the more common depthfirst search, and can be seen as a parallel composition between two parsing processes. The resulting library is simple and ecient for "almost deterministic" grammars, which are typical for programming languages and other computing science applications.
Flexible Dynamic Information Flow Control in the Presence of Exceptions
 UNDER CONSIDERATION FOR PUBLICATION IN J. FUNCTIONAL PROGRAMMING
, 2012
"... We describe a new, dynamic, floatinglabel approach to languagebased information flow control. A labeled IO monad, LIO, keeps track of a current label and permits restricted access to IO functionality. The current label floats to exceed the labels of all data observed and restricts what can be modi ..."
Abstract

Cited by 3 (1 self)
 Add to MetaCart
We describe a new, dynamic, floatinglabel approach to languagebased information flow control. A labeled IO monad, LIO, keeps track of a current label and permits restricted access to IO functionality. The current label floats to exceed the labels of all data observed and restricts what can be modified. Unlike other languagebased work, LIO also bounds the current label with a current clearance that provides a form of discretionary access control. Computations may encapsulate and pass around the results of computations with different labels. In addition, the LIO monad offers a simple form of labeled mutable references and exception handling. We give precise semantics and prove confidentiality and integrity properties of a callbyname λcalculus and provide an implementation in Haskell.
Zip Fusion with Hyperfunctions
, 2000
"... Automatic removal of intermediate structures has been... ..."
Abstract

Cited by 1 (1 self)
 Add to MetaCart
Automatic removal of intermediate structures has been...