Results 1  10
of
54
Monads for functional programming
, 1995
"... The use of monads to structure functional programs is described. Monads provide a convenient framework for simulating effects found in other languages, such as global state, exception handling, output, or nondeterminism. Three case studies are looked at in detail: how monads ease the modification o ..."
Abstract

Cited by 1312 (37 self)
 Add to MetaCart
The use of monads to structure functional programs is described. Monads provide a convenient framework for simulating effects found in other languages, such as global state, exception handling, output, or nondeterminism. Three case studies are looked at in detail: how monads ease the modification of a simple evaluator; how monads act as the basis of a datatype of arrays subject to inplace update; and how monads can be used to build parsers.
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.
Alias Types for Recursive Data Structures
, 2000
"... Linear type systems permit programmers to deallocate or explicitly recycle memory, but they are severly restricted by the fact that they admit no aliasing. This paper describes a pseudolinear type system that allows a degree of aliasing and memory reuse as well as the ability to define complex recu ..."
Abstract

Cited by 137 (14 self)
 Add to MetaCart
Linear type systems permit programmers to deallocate or explicitly recycle memory, but they are severly restricted by the fact that they admit no aliasing. This paper describes a pseudolinear type system that allows a degree of aliasing and memory reuse as well as the ability to define complex recursive data structures. Our type system can encode conventional linear data structures such as linear lists and trees as well as more sophisticated data structures including cyclic and doublylinked lists and trees. In the latter cases, our type system is expressive enough to represent pointer aliasing and yet safely permit destructive operations such as object deallocation. We demonstrate the flexibility of our type system by encoding two common compiler optimizations: destinationpassing style and DeutschSchorrWaite or "linkreversal" traversal algorithms.
Equivalence in Functional Languages with Effects
, 1991
"... Traditionally the view has been that direct expression of control and store mechanisms and clear mathematical semantics are incompatible requirements. This paper shows that adding objects with memory to the callbyvalue lambda calculus results in a language with a rich equational theory, satisfying ..."
Abstract

Cited by 112 (13 self)
 Add to MetaCart
Traditionally the view has been that direct expression of control and store mechanisms and clear mathematical semantics are incompatible requirements. This paper shows that adding objects with memory to the callbyvalue lambda calculus results in a language with a rich equational theory, satisfying many of the usual laws. Combined with other recent work this provides evidence that expressive, mathematically clean programming languages are indeed possible. 1. Overview Real programs have effectscreating new structures, examining and modifying existing structures, altering flow of control, etc. Such facilities are important not only for optimization, but also for communication, clarity, and simplicity in programming. Thus it is important to be able to reason both informally and formally about programs with effects, and not to sweep effects either to the side or under the store parameter rug. Recent work of Talcott, Mason, Felleisen, and Moggi establishes a mathematical foundation for...
How to Declare an Imperative
, 1995
"... How can we integrate interaction into a purely declarative language? This tutorial describes a solution to this problem based on a monad. The solution has been implemented in the functional language Haskell and the declarative language Escher. Comparisons are given to other approaches to interaction ..."
Abstract

Cited by 96 (3 self)
 Add to MetaCart
How can we integrate interaction into a purely declarative language? This tutorial describes a solution to this problem based on a monad. The solution has been implemented in the functional language Haskell and the declarative language Escher. Comparisons are given to other approaches to interaction based on synchronous streams, continuations, linear logic, and side effects.
Decision Problems for Propositional Linear Logic
, 1990
"... Linear logic, introduced by Girard, is a refinement of classical logic with a natural, intrinsic accounting of resources. We show that unlike most other propositional (quantifierfree) logics, full propositional linear logic is undecidable. Further, we prove that without the modal storage operator, ..."
Abstract

Cited by 90 (17 self)
 Add to MetaCart
Linear logic, introduced by Girard, is a refinement of classical logic with a natural, intrinsic accounting of resources. We show that unlike most other propositional (quantifierfree) logics, full propositional linear logic is undecidable. Further, we prove that without the modal storage operator, which indicates unboundedness of resources, the decision problem becomes pspacecomplete. We also establish membership in np for the multiplicative fragment, npcompleteness for the multiplicative fragment extended with unrestricted weakening, and undecidability for certain fragments of noncommutative propositional linear logic. 1 Introduction Linear logic, introduced by Girard [14, 18, 17], is a refinement of classical logic which may be derived from a Gentzenstyle sequent calculus axiomatization of classical logic in three steps. The resulting sequent system Lincoln@CS.Stanford.EDU Department of Computer Science, Stanford University, Stanford, CA 94305, and the Computer Science Labo...
Is there a use for linear logic?
, 1991
"... Past attempts to apply Girard's linear logic have either had a clear relation to the theory (Lafont, Holmstrom, Abramsky) or a clear practical value (Guzm'an and Hudak, Wadler), but not both. This paper defines a sequence of languages based on linear logic that span the gap between theory and practi ..."
Abstract

Cited by 88 (7 self)
 Add to MetaCart
Past attempts to apply Girard's linear logic have either had a clear relation to the theory (Lafont, Holmstrom, Abramsky) or a clear practical value (Guzm'an and Hudak, Wadler), but not both. This paper defines a sequence of languages based on linear logic that span the gap between theory and practice. Type reconstruction in a linear type system can derive information about sharing. An approach to linear type reconstruction based on use types is presented. Applications to the array update problem are considered.
Once Upon a Type
 In Functional Programming Languages and Computer Architecture
, 1995
"... A number of useful optimisations are enabled if we can determine when a value is accessed at most once. We extend the HindleyMilner type system with uses, yielding a typeinference based program analysis which determines when values are accessed at most once. Our analysis can handle higherorder fun ..."
Abstract

Cited by 81 (2 self)
 Add to MetaCart
A number of useful optimisations are enabled if we can determine when a value is accessed at most once. We extend the HindleyMilner type system with uses, yielding a typeinference based program analysis which determines when values are accessed at most once. Our analysis can handle higherorder functions and data structures, and admits principal types for terms. Unlike previous analyses, we prove our analysis sound with respect to callbyneed reduction. Callbyname reduction does not provide an accurate model of how often a value is used during lazy evaluation, since it duplicates work which would actually be shared in a real implementation. Our type system can easily be modified to analyse usage in a callbyvalue language. 1 Introduction This paper describes a method for determining when a value is used at most once. Our method is based on a simple modification of the HindleyMilner type system. Each type is labelled to indicate whether the corresponding value is used at most onc...
QuasiLinear Types
, 1999
"... Linear types (types of values that can be used just once) have been drawing a great deal of attention because they are useful for memory management, inplace update of data structures, etc.: an obvious advantage is that a value of a linear type can be immediately deallocated after being used. Howeve ..."
Abstract

Cited by 59 (5 self)
 Add to MetaCart
Linear types (types of values that can be used just once) have been drawing a great deal of attention because they are useful for memory management, inplace update of data structures, etc.: an obvious advantage is that a value of a linear type can be immediately deallocated after being used. However, the linear types have not been applied so widely in practice, probably because linear values (values of linear types) in the traditional sense do not so often appear in actual programs. In order to increase the applicability of linear types, we relax the condition of linearity by extending the types with information on an evaluation order and simple dataflow information. The extended type system, called a quasilinear type system, is formalized and its correctness is proved. We have implemented a prototype type inference system for the coreML that can automatically find out which value is linear in the relaxed sense. Promising results were obtained from preliminary experiments with the p...
A Brief Guide to Linear Logic
, 1993
"... An overview of linear logic is given, including an extensive bibliography and a simple example of the close relationship between linear logic and computation. ..."
Abstract

Cited by 53 (8 self)
 Add to MetaCart
An overview of linear logic is given, including an extensive bibliography and a simple example of the close relationship between linear logic and computation.