Embedded Haskell for Extensible Applications
Embedding a language in an application is an ideal way to extend and customise
that application. It is common for editors, window managers, and other large
applications to provide an application-specific language with some scripting
ability. Unfortunately, these custom languages tend to lack the features
available in stand-alone languages - useful type checking, coherent syntax,
libraries - under the rationale that they are only intended for small scripting
jobs. Inevitably, however, users start writing larger scripts and quickly
encounter the limits imposed by bad language design.
An alternative is to embed a rich stand-alone language in the application. The
obvious example of this approach is the emacs editor, which is scriptable in a
dialect of lisp. The vim editor provides some support for limited scripting in
several languages, including perl and python. However, in many cases, these
languages are still unsuitable for writing clear and correct code. Recent
developments in domain specific languages have shown Haskell to be well suited
for scripting applications. Its clean, expressive syntax and elegant semantics
make it ideal for domain specific scripting.
In this project you will develop a library for dynamic evaluation of
Haskell code, providing features users of lisp or other scripting
languages are accustomed to. Recently, a Haskell editor project has
begun, Yi, and in
this thesis you would design and implement the scripting and
extensibility infrastructure in Yi. You should be able to script and
extend Yi via your library.
Expectations
-
Core requirements for successful completion:
-
You should develop a library for interfacing with a Haskell compiler
or interpreter. This library should be callable from Haskell or C
code.
-
There should be a suitable design and implementation of a mechanism
for passing values/state between an application and the Haskell
system invoked by the library you develop.
-
You should successfully employ your library in Yi.
-
Extra tasks for the ambitious:
-
As well as being able to script the application in Haskell, you
could provide a convenient embedded domain-specific language(EDSL)
for scripting the objects of the application, in a more natural and
convenient way than just raw Haskell.
-
You can extend the library beyond the basic implementation, exposing
more of the Haskell system: call library code, multi-module scripts,
type checking facilities
-
And you could adapt more than one application to be scriptable by
your library.
-
Another possibility is to investigate ways to 'sandbox' the
scripts the user provides, such that they can only do what the
application allows them to do. This would be useful to ensure that
the editor script you get from the net doesn't delete your hard
drive.
References
-
Yi, the Haskell
extensible editor.
-
emacs: the extensible, customisable editor.
-
Lua, a powerful
light-weight programming language designed for extending
applications. Also, see Lua - an extensible extension language for the philosophy
of embedded languages.
-
Sawfish, an extensible
window manager using a Lisp-based scripting language.
Ion, a window
manager scriptable in Lua.
-
A proposal for a Haskell execution platform (an api to the
compiler). Some
Haskell interface tools.
Last modified : Sat Jan 8 14:26:51 EST 2005