Disornamentation
(see also ornamentation)
Introductory Examples
- Ornamenting nat to list is one of the smallest
examples of ornamentation. The code obtained can be disornamented without user
interaction: from lists to nat.
- Disornamentation makes it possible to go back and forth between the
ornamented and disornamented code. This example demonstrates several features
of the new prototype: disornamentation; adding new constructors; edition of
the ornamented code and of the disornamented code, while keeping both
synchronized. From bare expressions to localized expressions. At this occasion, we
introduce the robust patch language.
- From red-black trees to trees without any
balancing information. This disornamentation removes data that is used in the
computation. Therefore, one needs to supply patches.
- Using an ornament, sets can be converted to maps.
Surprisingly, the code of sets can be obtained by ornamentation from maps.
Indeed, there is an isomorphism between unit map and set.
However, it is more natural to obtain this code with disornamentation. This
example demonstrates disornamentation on a larger example:
maps to sets by disornamentation.
Other Transformations
- From an interpreter with named variables to a
De Bruijn interpreter: this example features a
transformation that mixes ornamentation and disornamentation.
- Other transformations can be dealt with in this framework. Adding new
independent constructors: an example on a tiny
language where we add substraction.
Technical Examples
- Dead code elimination
- Disornaments are implicitly polymorphic as there is no need to constrain
the type of variables that are removed. Therefore, we wrote a
small example which explains why it is
needed and how it works.