Results 1  10
of
30
Improvement in a Lazy Context: An Operational Theory for CallByNeed
 Proc. POPL'99, ACM
, 1999
"... Machine The semantics presented in this section is essentially Sestoft's \mark 1" abstract machine for laziness [Sestoft 1997]. In that paper, he proves his abstract machine 6 A. K. Moran and D. Sands h fx = Mg; x; S i ! h ; M; #x : S i (Lookup) h ; V; #x : S i ! h fx = V g; V; S i (Update) h ; ..."
Abstract

Cited by 40 (7 self)
 Add to MetaCart
Machine The semantics presented in this section is essentially Sestoft's \mark 1" abstract machine for laziness [Sestoft 1997]. In that paper, he proves his abstract machine 6 A. K. Moran and D. Sands h fx = Mg; x; S i ! h ; M; #x : S i (Lookup) h ; V; #x : S i ! h fx = V g; V; S i (Update) h ; M x; S i ! h ; M; x : S i (Unwind) h ; x:M; y : S i ! h ; M [ y = x ]; S i (Subst) h ; case M of alts ; S i ! h ; M; alts : S i (Case) h ; c j ~y; fc i ~x i N i g : S i ! h ; N j [ ~y = ~x j ]; S i (Branch) h ; let f~x = ~ Mg in N; S i ! h f~x = ~ Mg; N; S i ~x dom(;S) (Letrec) Fig. 1. The abstract machine semantics for callbyneed. semantics sound and complete with respect to Launchbury's natural semantics, and we will not repeat those proofs here. Transitions are over congurations consisting of a heap, containing bindings, the expression currently being evaluated, and a stack. The heap is a partial function from variables to terms, and denoted in an identical manner to a coll...
The CallbyNeed Lambda Calculus
 Journal of Functional Programming
, 1994
"... We present a calculus that captures the operational semantics of callbyneed. The callbyneed lambda calculus is confluent, has a notion of standard reduction, and entails the same observational equivalence relation as the callbyname calculus. The system can be formulated with or without explici ..."
Abstract

Cited by 39 (2 self)
 Add to MetaCart
We present a calculus that captures the operational semantics of callbyneed. The callbyneed lambda calculus is confluent, has a notion of standard reduction, and entails the same observational equivalence relation as the callbyname calculus. The system can be formulated with or without explicit let bindings, admits useful notions of marking and developments, and has a straightforward operational interpretation. Introduction The correspondence between callbyvalue lambda calculi and strict functional languages (such as the pure subset of Standard ML) is quite good; the correspondence between callby name lambda calculi and lazy functional languages (such as Miranda or Haskell) is not so good. Callbyname reevaluates an argument each time it is used, a prohibitive expense. Thus, many lazy languages are implemented using the callbyneed mechanism proposed by Wadsworth (1971), which overwrites an argument with its value the first time it is evaluated, avoiding the need for any s...
CallbyName, CallbyValue, CallbyNeed, and the Linear Lambda Calculus
, 1994
"... Girard described two translations of intuitionistic logic into linear logic, one where A > B maps to (!A) o B, and another where it maps to !(A o B). We detail the action of these translations on terms, and show that the first corresponds to a callbyname calculus, while the second corresponds t ..."
Abstract

Cited by 28 (5 self)
 Add to MetaCart
Girard described two translations of intuitionistic logic into linear logic, one where A > B maps to (!A) o B, and another where it maps to !(A o B). We detail the action of these translations on terms, and show that the first corresponds to a callbyname calculus, while the second corresponds to callbyvalue. We further show that if the target of the translation is taken to be an affine calculus, where ! controls contraction but weakening is allowed everywhere, then the second translation corresponds to a callbyneed calculus, as recently defined by Ariola, Felleisen, Maraist, Odersky, and Wadler. Thus the different calling mechanisms can be explained in terms of logical translations, bringing them into the scope of the CurryHoward isomorphism.
Equational Reasoning for Linking with FirstClass Primitive Modules
 In European Symposium on Programming
, 2000
"... . Modules and linking are usually formalized by encodings which use the calculus, records (possibly dependent), and possibly some construct for recursion. In contrast, we introduce the mcalculus, a calculus where the primitive constructs are modules, linking, and the selection and hiding of mo ..."
Abstract

Cited by 27 (5 self)
 Add to MetaCart
. Modules and linking are usually formalized by encodings which use the calculus, records (possibly dependent), and possibly some construct for recursion. In contrast, we introduce the mcalculus, a calculus where the primitive constructs are modules, linking, and the selection and hiding of module components. The mcalculus supports smooth encodings of software structuring tools such as functions ( calculus), records, objects (&calculus), and mutually recursive definitions. The mcalculus can also express widely varying kinds of module systems as used in languages like C, Haskell, and ML. We prove the mcalculus is confluent, thereby showing that equational reasoning via the mcalculus is sensible and well behaved. 1 Introduction A long version of this paper [43] which contains full proofs, more details and explanations, and comparisons with more calculi (including the calculus of Ancona and Zucca [4]), is available at http://www.cee.hw.ac.uk/~jbw/papers/. 1.1 Support f...
A calculus for linktime compilation
, 2000
"... Abstract. We present a module calculus for studying a simple model of linktime compilation. The calculus is stratified into a term calculus, a core module calculus, and a linking calculus. At each level, we show that the calculus enjoys a computational soundness property: iftwo terms are equivalent ..."
Abstract

Cited by 22 (4 self)
 Add to MetaCart
Abstract. We present a module calculus for studying a simple model of linktime compilation. The calculus is stratified into a term calculus, a core module calculus, and a linking calculus. At each level, we show that the calculus enjoys a computational soundness property: iftwo terms are equivalent in the calculus, then they have the same outcome in a smallstep operational semantics. This implies that any module transformation justified by the calculus is meaning preserving. This result is interesting because recursive module bindings thwart confluence at two levels ofour calculus, and prohibit application ofthe traditional technique for showing computational soundness, which requires confluence. We introduce a new technique, based on properties we call lift and project, thatusesa weaker notion of confluence with respect to evaluation to establish computational soundness for our module calculus. We also introduce the weak distributivity property for a transformation T operating on modules D1 and D2 linked by ⊕: T (D1 ⊕ D2) =T (T (D1) ⊕ T (D2)). We argue that this property finds promising candidates for linktime optimizations. 1
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...
Learning Programs: A Hierarchical Bayesian Approach
"... We are interested in learning programs for multiple related tasks given only a few training examples per task. Since the program for a single task is underdetermined by its data, we introduce a nonparametric hierarchical Bayesian prior over programs which shares statistical strength across multiple ..."
Abstract

Cited by 9 (1 self)
 Add to MetaCart
We are interested in learning programs for multiple related tasks given only a few training examples per task. Since the program for a single task is underdetermined by its data, we introduce a nonparametric hierarchical Bayesian prior over programs which shares statistical strength across multiple tasks. The key challenge is to parametrize this multitask sharing. For this, we introduce a new representation of programs based on combinatory logic and provide an MCMC algorithm that can perform safe program transformations on this representation to reveal shared interprogram substructures. 1.
Semantics of value recursion for monadic input/output
 Journal of Theoretical Informatics and Applications
, 2002
"... Abstract. Monads have been employed in programming languages for modeling various language features, most importantly those that involve side effects. In particular, Haskell’s IO monad provides access to I/O operations and mutable variables, without compromising referential transparency. Cyclic defi ..."
Abstract

Cited by 7 (1 self)
 Add to MetaCart
Abstract. Monads have been employed in programming languages for modeling various language features, most importantly those that involve side effects. In particular, Haskell’s IO monad provides access to I/O operations and mutable variables, without compromising referential transparency. Cyclic definitions that involve monadic computations give rise to the concept of valuerecursion, where the fixedpoint computation takes place only over the values, without repeating or losing effects. In this paper, we describe a semantics for a lazy language based on Haskell, supporting monadic I/O, mutable variables, usual recursive definitions, and value recursion. Our semantics is composed of two layers: A natural semantics for the functional layer, and a labeled transition semantics for the IO layer. Mathematics Subject Classification. 68N18, 68Q55, 18C15.
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...