Results 1 - 10
of
13
Tackling the awkward squad: monadic input/output, concurrency, exceptions, and foreign-language calls in Haskell
- Engineering theories of software construction
, 2001
"... Functional programming may be beautiful, but to write real applications we must grapple with awkward real-world issues: input/output, robustness, concurrency, and interfacing to programs written in other languages. These lecture notes give an overview of the techniques that have been developed by th ..."
Abstract
-
Cited by 88 (2 self)
- Add to MetaCart
Functional programming may be beautiful, but to write real applications we must grapple with awkward real-world issues: input/output, robustness, concurrency, and interfacing to programs written in other languages. These lecture notes give an overview of the techniques that have been developed by the Haskell community to address these problems. I introduce various proposed extensions to Haskell along the way, and I offer an operational semantics that explains what these extensions mean. This tutorial was given at the Marktoberdorf Summer School 2000. It will appears in the book “Engineering theories of software construction, Marktoberdorf Summer School 2000”, ed CAR Hoare, M Broy, and R Steinbrueggen, NATO ASI Series, IOS Press, 2001, pp47-96. This version has a few errors corrected compared with the published version. Change summary: Apr 2005: some examples added to Section 5.2.2, to clarifyevaluate. March 2002: substantial revision 1
From ML to Ada: Strongly-typed Language Interoperability via Source Translation
, 1993
"... We describe a system that supports source-level integration of ML-like functional language code with ANSI C or Ada83 code. The system works by translating the functional code into type-correct, "vanilla" C or Ada; it offers simple, efficient, type-safe inter-operation between new functional code com ..."
Abstract
-
Cited by 59 (3 self)
- Add to MetaCart
We describe a system that supports source-level integration of ML-like functional language code with ANSI C or Ada83 code. The system works by translating the functional code into type-correct, "vanilla" C or Ada; it offers simple, efficient, type-safe inter-operation between new functional code components and "legacy" third-generationlanguage components. Our translator represents a novel synthesis of techniques including user-parameterized specification of primitive types and operators; removal of polymorphism by code specialization; removal of higher-order functions using closure datatypes and interpretation; and aggressive optimization of the resulting first-order code, which can be viewed as encoding the result of a closure analysis. Programs remain fully typed at every stage of the translation process, using only simple, standard type systems. Target code runs at speeds comparable to the output of current optimizing ML compilers, even though handicapped by a conservative garbage collector.
Prototyping Real-Time Vision Systems: An Experiment in DSL Design
- In Proceedings of ICSE 99: Intl. Conf. on Software Engineering
, 1998
"... We describe the transformation of XVision, a large library of C++ code for real-time vision processing, into FVision (pronounced "fission"), a fully-featured domain-specific language embedded in Haskell. The resulting prototype system substantiates the claims of increased modularity, effective code ..."
Abstract
-
Cited by 13 (11 self)
- Add to MetaCart
We describe the transformation of XVision, a large library of C++ code for real-time vision processing, into FVision (pronounced "fission"), a fully-featured domain-specific language embedded in Haskell. The resulting prototype system substantiates the claims of increased modularity, effective code reuse, and rapid prototyping that characterize the DSL approach to system design. It also illustrates the need for judicious interface design: relegating computationally expensive tasks to XVision (pre-existing C++ components), and leaving modular compositional tasks to FVision (Haskell). At the same time, our experience demonstrates how Haskell's advanced language features (specifically parametric polymorphism, lazy evaluation, higher order functions and automatic storage reclamation) permit a rapid DSL design that is itself highly modular and easily modified. Overall, the resulting hybrid system exceeded our expectations: visual tracking programs continue to spend most of their time execut...
Integrating Interactive Tools using Concurrent Haskell and Synchronous Events
- In CLaPF'97: 2nd Latin-American Conference on Functional Programming
, 1997
"... . In this paper we describe how existing interactive tools can be integrated using Concurrent Haskell and synchronous events. The base technology is a higherorder approach to concurrency as in CML extended with a framework for handling external events of the environment. These events are represen ..."
Abstract
-
Cited by 8 (6 self)
- Add to MetaCart
. In this paper we describe how existing interactive tools can be integrated using Concurrent Haskell and synchronous events. The base technology is a higherorder approach to concurrency as in CML extended with a framework for handling external events of the environment. These events are represented as first class synchronous events to achieve a uniform, composable approach to event handling. Adaptors are interposed between the external event sources and the internal set of listening agents to achieve this degree of abstraction. A substantially improved integration framework compared to existing technology (such as for example the combination of Tcl/Tk with expect) is then provided. With this basis it is for example possible to wrap a GUI around the hugs interpreter with very little work required. 1 Introduction There are several ways in which existing tools can be encapsulated to work in an integrated environment. The general solution to interoperability is to use component...
The Bits Between The Lambdas: Binary Data in a Lazy Functional Language
- Proceedings of ACM International Symposium on Memory Management
, 1998
"... For the programmer, storage media are usually assumed to have a minimum atomic unit of transfer of one byte. However, sometimes it is useful to have an even finer storage granularity of one bit, for instance in order to compress data. This paper describes an API in the lazy functional language Haske ..."
Abstract
-
Cited by 6 (0 self)
- Add to MetaCart
For the programmer, storage media are usually assumed to have a minimum atomic unit of transfer of one byte. However, sometimes it is useful to have an even finer storage granularity of one bit, for instance in order to compress data. This paper describes an API in the lazy functional language Haskell for treating storage media as arbitrary-length streams of bits, without byte-alignment constraints. So far as possible, storage media are treated uniformly. In particular, bit-stream memory and binary files share the same API -- a new and useful abstraction over memory management and file management. This uniformity of access leads to a novel technique for lazy random-access to files in a purely functional manner. We also describe a technique for automatically deriving compressed binary representations of user-defined data structures, whose operations provide both in-heap data compression and convenient high-level binary I/O. Of many possible applications, we illustrate the processing of...
Foreign interface for PLT Scheme
- In Workshop on Scheme and Functional Programming
, 2004
"... Even a programmer devoted to Scheme may prefer using foreign libraries in certain situation. Connecting the two worlds involves glue code, usually using C, which requires significant programming efforts and system expertise. In this paper we describe a PLT Scheme extension for interacting with forei ..."
Abstract
-
Cited by 6 (0 self)
- Add to MetaCart
Even a programmer devoted to Scheme may prefer using foreign libraries in certain situation. Connecting the two worlds involves glue code, usually using C, which requires significant programming efforts and system expertise. In this paper we describe a PLT Scheme extension for interacting with foreign code, designed around a simple philosophy: stay in the fun world, evenifitisno longer a safe sand box. Our system relieves the programmer from low-level technicalities while keeping the benefits of Scheme as a better programming environment compared to C. 1
The UniForM WorkBench - a Higher Order Tool Integration Framework
- In International Workshop on Current Trends in Applied Formal Methods
, 1998
"... . The UniForM Workbench is an open ended tool integration framework for developing (formal) Software Development Environments (SDE) from the basis of pre-fabricated off-the-shelf development tools. The integration framework provides support for data, control and presentation integration as well ..."
Abstract
-
Cited by 5 (2 self)
- Add to MetaCart
. The UniForM Workbench is an open ended tool integration framework for developing (formal) Software Development Environments (SDE) from the basis of pre-fabricated off-the-shelf development tools. The integration framework provides support for data, control and presentation integration as well as utilities for wrapping Haskell interfaces around existing development tools. Entire SDE's are then glued together on the basis of these encapsulations using Concurrent Haskell as the integration language, thus allowing integration to be done at a level of abstraction that is very close to the one offered by constructive formal specifications. So far, the integration framework has successfully been used to integrate tools for Haskell program development as well as specification and proof tools for Z specifications. During the 80's there were several attempts to provide environments for synthesizing tightly integrated SDE's from the basis of abstract language specifications. The Sy...
Data-Level Interoperability
- Electronic Notes in Theoretical Computer Science
, 2000
"... Practical implementations of high-level languages must provide access to libraries and system services that have APIs specified in a low-level language (usually C). Our approach to supporting foreign interfaces in the MOBY compiler is based on a mechanism for data-level interoperability, which al ..."
Abstract
-
Cited by 5 (0 self)
- Add to MetaCart
Practical implementations of high-level languages must provide access to libraries and system services that have APIs specified in a low-level language (usually C). Our approach to supporting foreign interfaces in the MOBY compiler is based on a mechanism for data-level interoperability, which allows MOBY code to manipulate C data representations directly. Datalevel interoperability is important when dealing with large external data sets or data that is in a fixed format. It also serves as the foundation for a wide range of different foreign-interface policies. We describe tools that implement three such policies: Charon, which embeds C types directly into MOBY, moby-idl, which provides an IDL-based embedding, and an API miner, which enables application-specific embeddings. The benefits of our approach stem from the design of our compiler and do not rely on properties of the MOBY language. 1 Introduction High-level languages, such as most functional and object-oriented langu...
Type-directed continuation allocation
- In 2nd International Workshop on Types in Compilation, volume 1473 of LNCS
, 1998
"... Abstract. Suppose we translate two different source languages, £¥ ¤ and £§ ¦ , into the same intermediate language; can they safely interoperate in the same address space and under the same runtime system? If £ ¤ supports first-class continuations (call/cc) and £ ¦ does not, can £ ¦ programs call ..."
Abstract
-
Cited by 3 (1 self)
- Add to MetaCart
Abstract. Suppose we translate two different source languages, £¥ ¤ and £§ ¦ , into the same intermediate language; can they safely interoperate in the same address space and under the same runtime system? If £ ¤ supports first-class continuations (call/cc) and £ ¦ does not, can £ ¦ programs call arbitrary £ ¤ functions? Would the fact of possibly calling £¨ ¤ impose restrictions on the implementation strategy of £ ¦ ? Can we compile £ ¤ functions that do not invoke call/cc using more efficient techniques borrowed from the £ ¦ implementation? Our view is that the implementation of a common intermediate language ought to support the so-called pay-as-you-go efficiency: first-order monomorphic functions should be compiled as efficiently as in C and assembly languages, even though they may be passed to arbitrary polymorphic functions that support advanced control primitives (e.g. call/cc). In this paper, we present a typed intermediate language with effect and resource annotations, ensuring the safety of inter-language calls while allowing the compiler to choose continuation allocation strategies. 1
Handling Exceptions in Haskell
- In submitted to Practial Applications of Declarative Languages (PADL'99
, 1999
"... Using a language without exception handling is like driving a car with no brakes and no seatbelt --- things work fine until something goes wrong. You also learn to drive rather carefully. This paper describes an exception handling extension to the Haskell lazy functional language. The implementation ..."
Abstract
-
Cited by 3 (2 self)
- Add to MetaCart
Using a language without exception handling is like driving a car with no brakes and no seatbelt --- things work fine until something goes wrong. You also learn to drive rather carefully. This paper describes an exception handling extension to the Haskell lazy functional language. The implementation turned out to be very easy but we had problems finding a viable semantics for our system. The resulting semantics is a compromise between theoretical beauty and practical utility. 1 Introduction Haskell is an ivory tower language: full of lofty ideas, built on solid semantic foundations, praised by grey-bearded professors and about as much use in the real world as a chocolate teapot. For Haskell to emerge from the ivory tower, it must be possible to write the kinds of programs that less idealistic programmers can write in C, Java, Ada and other useful languages: programs that interact with the real world in interesting ways (using graphics, GUIs, databases, etc) and which are robust enough...

