Results 1  10
of
24
Monadic Encapsulation of Effects: A Revised Approach (Extended Version)
 Journal of Functional Programming
, 1999
"... Launchbury and Peyton Jones came up with an ingenious idea for embedding regions of imperative programming in a pure functional language like Haskell. The key idea was based on a simple modification of HindleyMilner's type system. Our first contribution is to propose a more natural encapsulati ..."
Abstract

Cited by 28 (4 self)
 Add to MetaCart
Launchbury and Peyton Jones came up with an ingenious idea for embedding regions of imperative programming in a pure functional language like Haskell. The key idea was based on a simple modification of HindleyMilner's type system. Our first contribution is to propose a more natural encapsulation construct exploiting higherorder kinds, which achieves the same encapsulation effect, but avoids the ad hoc type parameter of the original proposal. The second contribution is a type safety result for encapsulation of strict state using both the original encapsulation construct and the newly introduced one. We establish this result in a more expressive context than the original proposal, namely in the context of the higherorder lambdacalculus. The third contribution is a type safety result for encapsulation of lazy state in the higherorder lambdacalculus. This result resolves an outstanding open problem on which previous proof attempts failed. In all cases, we formalize the intended implementations as simple bigstep operational semantics on untyped terms, which capture interesting implementation details not captured by the reduction semantics proposed previously. 1
Mllike inference for classifiers
 In ESOP
, 2004
"... Abstract. Environment classifiers were proposed as a new approach to typing multistage languages. Safety was established in the simplytyped and letpolymorphic settings. While the motivation for classifiers was the feasibility of inference, this was in fact not established. This paper starts with ..."
Abstract

Cited by 27 (7 self)
 Add to MetaCart
Abstract. Environment classifiers were proposed as a new approach to typing multistage languages. Safety was established in the simplytyped and letpolymorphic settings. While the motivation for classifiers was the feasibility of inference, this was in fact not established. This paper starts with the observation that inference for the full classifierbased system fails. We then identify a subset of the original system for which inference is possible. This subset, which uses implicit classifiers, retains significant expressivity (e.g. it can embed the calculi of Davies and Pfenning) and eliminates the need for classifier names in terms. Implicit classifiers were implemented in MetaOCaml, and no changes were needed to make an existing test suite acceptable by the new type checker. 1
Specifying superscalar microprocessors in Hawk
 In Formal Techniques for Hardware and Hardwarelike Systems. Marstrand
, 1998
"... Hawk is a language for the specification of microprocessors at the microarchitectural level. In this paper we use Hawk to specify a modern microarchitecture based on the Intel P6 with features such as speculation, register renaming, and superscalar outoforder execution. ..."
Abstract

Cited by 25 (4 self)
 Add to MetaCart
Hawk is a language for the specification of microprocessors at the microarchitectural level. In this paper we use Hawk to specify a modern microarchitecture based on the Intel P6 with features such as speculation, register renaming, and superscalar outoforder execution.
Correctness of Monadic State: An Imperative CallbyNeed Calculus
 In Proc. 25th ACM Symposium on Principles of Programming Languages
, 1998
"... The extension of Haskell with a builtin state monad combines mathematical elegance with operational efficiency: ffl Semantically, at the source language level, constructs that act on the state are viewed as functions that pass an explicit store data structure around. ffl Operationally, at the imp ..."
Abstract

Cited by 20 (2 self)
 Add to MetaCart
The extension of Haskell with a builtin state monad combines mathematical elegance with operational efficiency: ffl Semantically, at the source language level, constructs that act on the state are viewed as functions that pass an explicit store data structure around. ffl Operationally, at the implementation level, constructs that act on the state are viewed as statements whose evaluation has the sideeffect of updating the implicit global store in place. There are several unproven conjectures that the two views are consistent. Recently, we have noted that the consistency of the two views is far from obvious: all it takes for the implementation to become unsound is one judiciouslyplaced betastep in the optimization phase of the compiler. This discovery motivates the current paper in which we formalize and show the correctness of the implementation of monadic state. For the proof, we first design a typed callbyneed language that models the intermediate language of the compiler, to...
Monadic Regions
, 2004
"... Regionbased type systems provide programmer control over memory management without sacrificing typesafety. However, the type systems for regionbased languages, such as the MLKit or Cyclone, are relatively complicated, so proving their soundness is nontrivial. This paper shows that the complicati ..."
Abstract

Cited by 17 (2 self)
 Add to MetaCart
Regionbased type systems provide programmer control over memory management without sacrificing typesafety. However, the type systems for regionbased languages, such as the MLKit or Cyclone, are relatively complicated, so proving their soundness is nontrivial. This paper shows that the complication is in principle unnecessary. In particular, we show that plain old parametric polymorphism, as found in Haskell, is all that is needed. We substantiate this claim by giving a type and meaningpreserving translation from a regionbased language based on core Cyclone to a monadic variant of System F with region primitives whose types and operations are inspired by (and generalize) the ST monad.
Monadic Encapsulation in ML
 In Proceedings of the 4th ACM SIGPLAN International Conference on Functional Programming (ICFP’99
, 1999
"... In a programming language with procedures and assignments, it is often important to isolate uses of state to particular program fragments. The frameworks of type, region, and effect inference, and monadic state are technologies that have been used to state and enforce the property that an expression ..."
Abstract

Cited by 15 (2 self)
 Add to MetaCart
In a programming language with procedures and assignments, it is often important to isolate uses of state to particular program fragments. The frameworks of type, region, and effect inference, and monadic state are technologies that have been used to state and enforce the property that an expression has no visible sideeffects. This property has been exploited to justify the deallocation of memory regions despite the presence of dangling pointers. Starting from an idea developed in the context of monadic state in Haskell, we develop an MLlike language with full assignments and an operator that enforces the encapsulation of effects. Using this language, we formalize and prove the folklore connection between effect masking and monadic encapsulation. Then, by employing a novel set of reductions to deal with dangling pointers, we establish the soundness of the typebased encapsulation with a proof based on a standard subject reduction argument. 1 Introduction Two of the recurring theme...
What is a Purely Functional Language?
 Journal of Functional Programming
, 1998
"... Functional programming languages are informally classified into pure and impure languages. The precise meaning of this distinction has been a matter of controversy. We therefore investigate a formal definition of purity. We begin by showing that some proposed definitions that rely on confluence, sou ..."
Abstract

Cited by 14 (6 self)
 Add to MetaCart
Functional programming languages are informally classified into pure and impure languages. The precise meaning of this distinction has been a matter of controversy. We therefore investigate a formal definition of purity. We begin by showing that some proposed definitions that rely on confluence, soundness of the beta axiom, preservation of pure observational equivalences, and independence of the order of evaluation, do not withstand close scrutiny. We propose instead a definition based on parameterpassing independence. Intuitively, the definition implies that functions are pure mappings from arguments to results; the operational decision of how to pass the arguments is irrelevant. In the context of Haskell, our definition is consistent with the fact that the traditional callbyname denotational semantics coincides with the traditional callbyneed implementation. Furthermore, our definition is compatible with the streambased, continuationbased, and monadbased integration of computa...
Witnessing sideeffects
 In Proceedings of the 10th ACM SIGPLAN International Conference on Functional Programming. ACM
, 2005
"... We present a new approach to the old problem of adding global mutable state to purely functional languages. Our idea is to extend the language with “witnesses, ” which is based on an arguably more pragmatic motivation than past approaches. We give a semantic condition for correctness and prove it is ..."
Abstract

Cited by 11 (5 self)
 Add to MetaCart
We present a new approach to the old problem of adding global mutable state to purely functional languages. Our idea is to extend the language with “witnesses, ” which is based on an arguably more pragmatic motivation than past approaches. We give a semantic condition for correctness and prove it is sufficient. We also give a somewhat surprising static checking algorithm that makes use of a network flow property equivalent to the semantic condition via reduction to a satisfaction problem for a system of linear inequalities.
From Syntactic Theories to Interpreters: Automating the Proof of Unique Decomposition
 HigherOrder and Symbolic Computation
, 2001
"... Developing syntactic theories for reasoning about programming languages usually involves proving a uniquedecomposition lemma. The proof of such a lemma is tedious, errorprone, and is usually attempted many times during the design of a theory. We therefore investigate the automation of such proofs. ..."
Abstract

Cited by 11 (0 self)
 Add to MetaCart
Developing syntactic theories for reasoning about programming languages usually involves proving a uniquedecomposition lemma. The proof of such a lemma is tedious, errorprone, and is usually attempted many times during the design of a theory. We therefore investigate the automation of such proofs.
Recursion is a Computational Effect
, 2000
"... In a recent paper, Launchbury, Lewis, and Cook observe that some Haskell applications could benefit from a combinator mfix for expressing recursion over monadic types. We investigate three possible definitions of mfix and implement them in Haskell. Like traditional fixpoint operators, there are ..."
Abstract

Cited by 7 (1 self)
 Add to MetaCart
In a recent paper, Launchbury, Lewis, and Cook observe that some Haskell applications could benefit from a combinator mfix for expressing recursion over monadic types. We investigate three possible definitions of mfix and implement them in Haskell. Like traditional fixpoint operators, there are two approaches to the definition of mfix: an unfolding one based on mathematical semantics, and an updating one based on operational semantics. The two definitions are equivalent in pure calculi but have different behaviors when used within monads. The unfolding version can be easily defined in Haskell if one restricts fixpoints to function types. The updating version is much more challenging to define in Haskell despite the fact that its definition is straightforward in Scheme. After studying the Scheme definition in detail, we mirror it in Haskell using the primitive unsafePerformIO. The resulting definition of mfix appears to work well but proves to be unsafe, in the sense that i...