40 Years of Computing at Newcastle
Department Technical Report Series No. 577
Constructing Configurable Applications by Combining Monads
C.M. Angus
University of Newcastle upon Tyne. 1997.
Abstract
Monads provide a way of structuring functional programs, with many computational behaviours being easily modelled in terms of primitive monads. Most real programs however require a combination of different actions and hence combinations of primitive monads. In practice it is usually possible to construct a monad to support combinations of features. However the way this is achieved is usually ad-hoc.
We show how composite monads may be formed by:
- combining existing monads to form Cartesian products and
- composing monad transformations
We then demonstrate how these techniques may be used to build configurable applications, in a style reminiscent of Object Oriented programming, whose behaviour depends on the particular monad used. The monad can be selected at run-time and hence the behaviour of an application may be configured at run-time. Using the notation of constructor classes, we demonstrate the technique with an example of a configurable interpreter.
Department Technical Report Series - 1997
Department Technical Report Series Index
Contents Page - 40 Years of Computing at Newcastle
Technical Report Abstract No. 577, 30 June 1997