80 research outputs found
A Semantics for Tracing
We define a small step operational semantics for a core of Haskell. We modify this semantics to generate traces, specifically Augmented Redex Trails. This small and direct definition of Augmented Redex Trails shall improve our understanding of them and shall help to extend them systematically
Common Subexpression Elimination in a Lazy Functional Language
Common subexpression elimination is a well-known compiler optimisation that saves time by avoiding the repetition of the same computation. To our knowledge it has not yet been applied to lazy functional programming languages, although there are several advantages. First, the referential transparency of these languages makes the identification of common subexpressions very simple. Second, more common subexpressions can be recognised because they can be of arbitrary type whereas standard common subexpression elimination only shares primitive values. However, because lazy functional languages decouple program structure from data space allocation and control flow, analysing its effects and deciding under which conditions the elimination of a common subexpression is beneficial proves to be quite difficult. We developed and implemented the transformation for the language Haskell by extending the Glasgow Haskell compiler and measured its effectiveness on real-world programs
The Sigma-Semantics: A Comprehensive Semantics for Functional Programs
A comprehensive semantics for functional programs is presented, which generalizes the well-known call-by-value and call-by-name semantics. By permitting a separate choice between call-by value and call-by-name for every argument position of every function and parameterizing the semantics by this choice we abstract from the parameter-passing mechanism. Thus common and distinguishing features of all instances of the sigma-semantics, especially call-by-value and call-by-name semantics, are highlighted. Furthermore, a property can be validated for all instances of the sigma-semantics by a single proof. This is employed for proving the equivalence of the given denotational (fixed-point based) and two operational (reduction based) definitions of the sigma-semantics. We present and apply means for very simple proofs of equivalence with the denotational sigma-semantics for a large class of reduction-based sigma-semantics. Our basis are simple first-order constructor-based functional programs with patterns
The Sigma-Semantics: A Comprehensive Semantics for Functional Programs
A comprehensive semantics for functional programs is presented, which generalizes the well-known call-by-value and call-by-name semantics. By permitting a separate choice between call-by value and call-by-name for every argument position of every function and parameterizing the semantics by this choice we abstract from the parameter-passing mechanism. Thus common and distinguishing features of all instances of the sigma-semantics, especially call-by-value and call-by-name semantics, are highlighted. Furthermore, a property can be validated for all instances of the sigma-semantics by a single proof. This is employed for proving the equivalence of the given denotational (fixed-point based) and two operational (reduction based) definitions of the sigma-semantics. We present and apply means for very simple proofs of equivalence with the denotational sigma-semantics for a large class of reduction-based sigma-semantics. Our basis are simple first-order constructor-based functional programs with patterns
Linear, bounded, functional pretty-printing
We present two implementations of Oppen's pretty-printing algorithm in Haskell that meet the efficiency of Oppen's imperative solution but have a simpler, clear structure. We start with an implementation that uses lazy evaluation to simulate two co-operating processes. Then we present an implementation that uses higher-order functions for delimited continuations to simulate co-routines with explicit scheduling
Enumerating Counter-Factual Type Error Messages with an Existing Type Checker
The type error message of a standard type checker for a functional language gives only a single location as potential cause of the type error. If that location is not the cause, which often is the case, then the type error message hardly helps in locating the real cause. Here we present a method that uses a standard type checker to enumerate locations that potentially cause the type error, each with an actual and a counter-factual type for the given location. Adding our method to existing compilers requires only limited effort but improves type error debugging substantially
Enumerating Counter-Factual Type Error Messages with an Existing Type Checker (poster+demo)
The Hindley-Milner type system is a foundation for most statically typed
functional programming languages, such as ML, OCaml and Haskell. This type
system has many advantageous, but it does make type debugging hard: If a
program is not well-typed, it can be difficult for the programmer to locate the
cause of the type error, that is, to determine where to change the program how.
Many solutions to the problem have been proposed. Here we propose a new
solution with two distinctive advantages: It is easy to use for the functional
programmer, because it appears to be only a minor extension of the type error
messages they are already familiar with. It is easy to implement, because it does
not require the implementation of a new type checker, but instead reuses any
existing one as a subroutine (like [2])
Type Generic Observing
Observing intermediate values helps to understand what is going on when your program runs.
Gill presented an observation method for lazy functional languages that
preserves the program's semantics.
However, users need to define for each type how its values are observed:
a laborious task and strictness of the program can easily be affected.
Here we define how any value can be observed based on the structure of its type
by applying generic programming frameworks.
Furthermore we present an extension to specify per observation point how much to observe of a value.
We discuss especially functional values and behaviour based on class membership
in generic programming frameworks
Heat — An Interactive Development Environment for Learning & Teaching Haskell
Using a separate editor and interpreter provides many distracting obstacles for inexperienced students learning a programming language. Professional interactive development environments, however, confuse these students with their excessive features. Hence this paper presents Heat, an interactive development environment specially designed for novice students learning the functional programming language Haskell. Based on teaching experience, Heat provides a small number of features and is easy to use. Heat proves that a small portable interactive development environment can be implemented on top of but independent of a particular Haskell interpreter. Heat with Hugs has been used in teaching functional programming at the University of Kent for the past three years
- …