Results 1  10
of
15
Monatron: an extensible monad transformer library. Available at http://www.cs.nott.ac.uk/~mjj/pubs/monatron.pdf
"... Abstract. Monads are pervasive in functional programming. In order to reap the benefits of their abstraction power, combinator libraries for monads are necessary. Monad transformers provide the basis for such libraries, and are based on a design that has proved to be successful. In this article, we ..."
Abstract

Cited by 17 (2 self)
 Add to MetaCart
(Show Context)
Abstract. Monads are pervasive in functional programming. In order to reap the benefits of their abstraction power, combinator libraries for monads are necessary. Monad transformers provide the basis for such libraries, and are based on a design that has proved to be successful. In this article, we show that this design has a number of shortcomings and provide a new design that builds on the strengths of the traditional design, but addresses its problems. 1
Handlers in Action
"... We lay operational foundations for effect handlers. Introduced by Plotkin and Pretnar, effect handlers are a novel programming construct that generalises exception handlers, handling a range of computational effects, such as I/O, state, and nondeterminism. We propose a smallstep structural operatio ..."
Abstract

Cited by 15 (1 self)
 Add to MetaCart
(Show Context)
We lay operational foundations for effect handlers. Introduced by Plotkin and Pretnar, effect handlers are a novel programming construct that generalises exception handlers, handling a range of computational effects, such as I/O, state, and nondeterminism. We propose a smallstep structural operational semantics for a higherorder calculus of effect handlers, along with a sound type and effect system. We explore two alternative effect handler implementation techniques: free monads, and delimited continuations. Finally, we show that Filinski’s monadic reflection can be straightforwardly simulated by effect handlers. 1.
The constrainedmonad problem
 In Proceedings of the 18th ACM SIGPLAN international conference on Functional programming. ACM
, 2013
"... In Haskell, there are many data types that would form monads were it not for the presence of typeclass constraints on the operations on that data type. This is a frustrating problem in practice, because there is a considerable amount of support and infrastructure for monads that these data types ca ..."
Abstract

Cited by 8 (1 self)
 Add to MetaCart
(Show Context)
In Haskell, there are many data types that would form monads were it not for the presence of typeclass constraints on the operations on that data type. This is a frustrating problem in practice, because there is a considerable amount of support and infrastructure for monads that these data types cannot use. Using several examples, we show that a monadic computation can be restructured into a normal form such that the standard monad class can be used. The technique is not specific to monads, and we show how it can also be applied to other structures, such as applicative functors. One significant use case for this technique is domainspecific languages, where it is often desirable to compile a deep embedding of a computation to some other language, which requires restricting the types that can appear in that computation.
Short Cut Fusion of Recursive Programs with Computational Effects
 SYMPOSIUM ON TRENDS IN FUNCTIONAL PROGRAMMING 2008 (TFP'08)
, 2008
"... Fusion is the process of improving the efficiency of modularly constructed programs by transforming them into monolithic equivalents. This paper defines a generalization of the standardbuild combinator which expresses uniform production of functorial contexts containing data of inductive types. It a ..."
Abstract

Cited by 7 (1 self)
 Add to MetaCart
Fusion is the process of improving the efficiency of modularly constructed programs by transforming them into monolithic equivalents. This paper defines a generalization of the standardbuild combinator which expresses uniform production of functorial contexts containing data of inductive types. It also proves correct a fusion rule which generalizes thefold/build andfold/buildp rules from the literature, and eliminates intermediate data structures of inductive types without disturbing the contexts in which they are situated. An important special case arises when this context is monadic. When it is, a second rule for fusing combinations of producers and consumers via monad operations, rather than via composition, is also available. We give examples illustrating both rules, and consider their coalgebraic duals as well.
Reflection without Remorse Revealing a hidden sequence to speed up monadic reflection
"... A series of list appends or monadic binds for many monads performs algorithmically worse when leftassociated. Continuationpassing style (CPS) is wellknown to cure this severe dependence of performance on the association pattern. The advantage of CPS dwindles or disappears if we have to examine o ..."
Abstract

Cited by 2 (0 self)
 Add to MetaCart
(Show Context)
A series of list appends or monadic binds for many monads performs algorithmically worse when leftassociated. Continuationpassing style (CPS) is wellknown to cure this severe dependence of performance on the association pattern. The advantage of CPS dwindles or disappears if we have to examine or modify the intermediate result of a series of appends or binds, before continuing the series. Such examination is frequently needed, for example, to control search in nondeterminism monads. We present an alternative approach that is just as general as CPS but more robust: it makes series of binds and other such operations efficient regardless of the association pattern – and also provides efficient access to intermediate results. The key is to represent such a conceptual sequence as an efficient sequence data structure. Efficient sequence data structures from the literature are homogeneous and cannot be applied as they are in a typesafe way to series of monadic binds. We generalize them to type aligned sequences and show how to construct their (assuredly orderpreserving) implementations. We demonstrate that our solution solves previously undocumented, severe performance problems in iteratees, LogicT transformers, free monads and extensible effects. Categories and Subject Descriptors D.3.2 [Programming Lan
Explicit Binds: Effortless Efficiency with and without Trees
"... Abstract. We demonstrate a simple and robust program transformation technique that can improve asymptotic time complexity of datamanipulating programs (e.g., produce a lineartime list reversal function from the obvious quadratic one). In the version of the present paper, it applies to monadic induc ..."
Abstract

Cited by 1 (0 self)
 Add to MetaCart
(Show Context)
Abstract. We demonstrate a simple and robust program transformation technique that can improve asymptotic time complexity of datamanipulating programs (e.g., produce a lineartime list reversal function from the obvious quadratic one). In the version of the present paper, it applies to monadic inductive datatypes and can be stated in two flavors, through a datatype representation, with an explicit (“frozen”) bind constructor and a special associated defining clause for the fold function, and in a functional form (generalized Church numerals), with a special definition of the bind function in terms of the build constructor. The technique explicates, systematizes, combines and scales a number of ideas known from the literature, achieving a new level of generality. 1
Modular Rollback through Control Logging A Pair of Twin Functional Pearls
"... We present a technique, based on the use of firstclass control operators, enabling programs to maintain and invoke rollback logs for sequences of reversible effects. Our technique is modular, in that it provides complete separation between some library of effectful operations, and a client, “driver ..."
Abstract

Cited by 1 (1 self)
 Add to MetaCart
We present a technique, based on the use of firstclass control operators, enabling programs to maintain and invoke rollback logs for sequences of reversible effects. Our technique is modular, in that it provides complete separation between some library of effectful operations, and a client, “driver ” program which invokes and rolls back sequences of these operations. In particular, the checkpoint mechanism, which is entirely encapsulated within the effect library, logs not only the library’s effects, but also the client’s control state. Thus, logging and rollback can be almost completely transparent to the client code. This separation of concerns manifests itself nicely when we must implement software with sophisticated error handling. We illustrate with two examples that exploit the architecture to disentangle some core parsing task from its error management. The parser code is completely separate from the errorcorrection code, although the two components are deeply intertwined at run time.
Monadic Fold, Monadic Build, Monadic Short Cut Fusion
"... Short cut fusion improves the efficiency of modularly constructed programs by eliminating intermediate data structures produced by one program component and immediately consumed by another. We define a combinator which expresses uniform production of data structures in monadic contexts, and is the n ..."
Abstract

Cited by 1 (0 self)
 Add to MetaCart
(Show Context)
Short cut fusion improves the efficiency of modularly constructed programs by eliminating intermediate data structures produced by one program component and immediately consumed by another. We define a combinator which expresses uniform production of data structures in monadic contexts, and is the natural counterpart to the wellknown monadic fold which consumes them. Like the monadic fold, our new combinator quantifies over monadic algebras rather than standard ones. Together with the monadic fold, it gives rise to a new short cut fusion rule for eliminating intermediate data structures in monadic contexts. This new rule differs significantly from previous short cut fusion rules, all of which are based on combinators which quantify over standard, rather than monadic, algebras. We give examples illustrating the benefits of quantifying over monadic algebras, prove our new fusion rule correct, and show how it can improve programs. We also consider its coalgebraic dual. 1 THE PROBLEM Consider the following variation on the wellknown problem of fusing modular
The ConstrainedMonad Problem (Corrected Version, 9th June 2014)
"... In Haskell, there are many data types that would form monads were it not for the presence of typeclass constraints on the operations on that data type. This is a frustrating problem in practice, because there is a considerable amount of support and infrastructure for monads that these data types ca ..."
Abstract
 Add to MetaCart
(Show Context)
In Haskell, there are many data types that would form monads were it not for the presence of typeclass constraints on the operations on that data type. This is a frustrating problem in practice, because there is a considerable amount of support and infrastructure for monads that these data types cannot use. Using several examples, we show that a monadic computation can be restructured into a normal form such that the standard monad class can be used. The technique is not specific to monads, and we show how it can also be applied to other structures, such as applicative functors. One significant use case for this technique is domainspecific languages, where it is often desirable to compile a deep embedding of a computation to some other language, which requires restricting the types that can appear in that computation.