Form follows function: Editor GUIs in a functional style

Programming a graphical user interface (GUI) is often time-consuming and boring, requires quite some knowledge about the GUI library, and is likely to result in monolithic, badly readable and inflexible code— even for small and simple programs like editors. These omnipresent GUI parts (for example, all ‘Options’ and ‘Properties’ dialogs are editors) allow the user to inspect and update a set of values. We introduce a small abstract language for describing editors in a modular, flexible, compositional and concise way. In this language, an editor is characterized by its subject type, the type of values it can edit. The operators ⊗, ⊕ and C are used to construct new editors with new subject types. We implement this language as a layer of functions upon the Object I/O Library in the purely functional language Clean. Using this functions, it is indeed possible to quickly construct editors in a declarative way, i.e. without defining object identifiers and event handlers. However, the layout structure of these editors is coupled to the structure of their subject type. We investigate two approaches to decouple these two structures: using a monadic style and using references.