archives

A New Paradigm for Component-Based Development

The May issue of Journal of Software contains a paper that applies dependent type theory to component-based programming.
The paper is potentially interesting to people interested in extending Haskell's type system in various directions.

Abstract
Hancock and Setzer describe how Haskell’s monolithic IO monad can be decomposed into worlds when working in a dependently typed language, like Martin-Löf’s type theory.

This paper introduces the notion of world map and shows that worlds and world maps form a category with arbitrary products. The construction of the category is carried out entirely in type theory and directly implementable in dependently typed programming languages.

If we let the notion of world replace the standard notion of interface, and the notion of world map replace the standard notion of component, we get a rigorous paradigm for component-based development. This new paradigm is investigated and several applications are given. For example, the problem of session state is given a very clean solution.

The paper has open access and is available from here.

PDF direct link.

Order structure, an excercise in abstraction and multiple inheritance

Order structures seem to be abstract concepts of theoretical mathematics with
minor practical importance. But this is just at first glance. A closer look
reveals that many data types have order structure.

  • The basic types NATURAL, INTEGER, FLOAT etc. have a total order
  • The type SET[T] has a partial order with "is_subset" playing the role of
    "<=".
  • All inductive types have a partial order where "a<=b" means "a has been used
    directly or indirectly in the construction of b". E.g. any subtree of a tree
    is smaller than the tree.
  • The nodes in a graph have a preorder relation with "a<=b" meaning "a can
    reach b".
  • The functions "f:A->B" have a partial order where the "smaller" function has
    the same values as the "greater" function but has a restricted domain.
  • The predicates "p:T?" have a partial order where "a<=b" meaning "a" is
    stronger than "b", i.e. "a" has less elements for which it is true than "b".

The article Order structure, an excercise in abstraction and multiple inheritance
describes preorders and partial orders together with the basic assertions which can
be derived from the basic structure and its functions.

Why is it interesting to carve out the order structure?

It is possible to prove a lot of properties by just using the definition of
the functions of order relations. Any structure which inherits the appropriate
order relation has access to all already proved asssertions. The order classes
act as an "assertion library" and inheritance is reuse of these assertions.