Overview of Vital

The main features of the Vital approach are: In the following sections, these features are illustrated with some very simple examples.

Document-centered approach

A Haskell program consists of a collection of modules (some written by the user, others imported from a library). A module consists of a collection of items (declarations, expressions and comments) and is displayed as a document. The user constructs a document by placing (in a free-format layout) items on it. The system evaluates the declarations and expressions, and displays their values alongside them. The system is 'live' in the sense that (as with a spreadsheet) changing any part of a document causes an immediate update of all dependent values.

A simple document is shown here. It consists of a comment, a declaration (n = 2 + 2) and an expression (reverse [1 .. n]).

Demand-driven evaluation

Haskell has a non-strict semantics: expressions are evaluated only to the minimal extent necessary. In Vital, evaluation is demand-driven by the need to display the result. For instance, in the list comprehension expression shown here, evaluation of the infinite list [n * n | n <- [0 ..]] proceeds only far enough to reach the edge of the viewport through which the document is viewed.

Documents, however, are notionally infinite in extent and may be dragged relative to the viewport thus forcing further evaluation and allowing the nether regions of large or infinite data structures to be displayed (as shown here).

Styles

Haskell values may be displayed either textually or diagrammatically. The way that a Haskell value is displayed is determined by an associated style (itself an ordinary Haskell value). For example, a style can be defined to display a list diagrammatically, with a vertical orientation and with each of its elements boxed. The declarations for a collection of styles may be gathered together as a stylesheet, itself an ordinary Haskell module.

Typically, whenever a user declares a new datatype (concrete or abstract) he will also specify (by defining an appropriate instance of the Edit type class) a default style for the display of values of that type.

Styles are also used to define the way that comments are displayed and, in particular, to attach hyperlinks to them, facilitating navigation amongst the set of documents making up a complete program.

Graphics

Pictures (elements of a predefined Picture datatype) may also be displayed and manipulated. A picture may consist not only of simple geometric elements (lines, rectangles, etc.) but also of picture-valued functions. This allows both simple animations (for example, a scrolling waveform) and more complex interactive pictures (such as a mouse-controlled arcade game).
Images (as bitmaps of a predefined type Image) may also be included as components of pictures.

Libraries (of Haskell modules) can be defined to allow more complex graphical representations. Here, for example, a library of bar chart drawing functions is imported and used to draw a chart of the first few digits (3, 1, 4, 1, 5, etc.) of pi.

Direct manipulation of data structures

Vital allows a user to select (by mouse) a component of a data structure and then to use Copy and Paste operations to modify or move it. This gives the user a high-level, graphical means of constructing complex literal data structures.

For example, a user wishing to define a triangular array of numeric literals can first create an 'empty' array and then point and click to edit data into its cells (in the same way as data is entered into a spreadsheet).
As each operation is performed, the original Haskell declaration is modified to take account of the change (and hence the values of any dependent expressions reflect the change).
As well as the values of the elements, the form of a data structure can be changed. For example, given a tree datatype and a typical tree value, shown here
Using point and click operations, the left subtree can be Copied to the clipboard and then Pasted into the the rightmost sub-subtree, resulting in the new tree shown here.

Direct manipulation of ADT values

A user-defined set of operations can be associated with any datatype (concrete or abstract). For example, a user dealing with a problem involving binary relations can introduce an ADT for binary relations, and then (by defining an instance of the Edit type class, specify how a binary relation should be displayed graphically and specify a set of operations on and between binary relations.
A menu of these operations is presented to the user on right-clicking on a binary relation. Selecting one of these operations updates the source text of the declaration/expression and thus (indirectly) the displayed value.

Typically, in any particular domain (engineering, economics, etc.) an expert user would be called up to identify and implement a library of relevant ADTs. Thereafter, an end user will be able to put together documents expressed largely in terms of these high-level, domain-specific abstractions and defining particular instances of them (such as the binary relation illustrated here) by simple point-and-click operations on pictorial representations.

Persistence

A documents developed in Vital may be saved to file and later restored in an identical state. It is saved as an ordinary Haskell program (with layout and style information embedded as comments, and any stylesheet imported as an ordinary Haskell module). This means that a Haskell program can be developed interactively using Vital and any literal data edited into its data structures, and then (if required) it can be run on an offline Haskell system.
Feedback on any aspect of Vital is welcome. Updated Dec 04