Putting Declarative Programming into the Web: Translating Curry to JavaScript

by Michael Hanus

Proc. of the 9th International ACM SIGPLAN Conference on Principles and Practice of Declarative Programming (PPDP'07), ACM Press, pp. 155-166, 2007
© ACM Press

We propose a framework to construct web-oriented user interfaces in a high-level way by exploiting declarative programming techniques. Such user interfaces are intended to manipulate complex data in a type-safe way, i.e., it is ensured that only type-correct data is accepted by the interface, where types can be specified by standard types of a programming language as well as any computable predicate on the data. The interfaces are web-based, i.e., the data can be manipulated with standard web browsers without any specific requirements on the client side. However, if the client's browser has JavaScript enabled, one could also check the correctness of the data on the client side providing immediate feedback to the user. In order to release the application programmer from the tedious details to interact with JavaScript, we propose an approach where the programmer must only provide a declarative description of the requirements of the user interface from which the necessary JavaScript programs and HTML forms are automatically generated. This approach leads to a very concise and maintainable implementation of web-based user interfaces. We demonstrate an implementation of this concept in the declarative multi-paradigm language Curry where the integrated functional and logic features are exploited to enable the high level of abstraction proposed in this paper.

PDF (187 KB) BibTeX-Entry