An idiom’s guide to formlets

Ezra Cooper, Sam Lindley, Philip Wadler, Jeremy Yallop

Research output: Working paper

27 Downloads (Pure)

Abstract

We present a novel approach to HTML form abstraction, which we call formlets. A formlet hides the underlying representation of a data type. For instance, a date formlet may allow a user to enter a date as a single text field, or separate fields for day, month, and year, or a combination of pulldown menus, or a custom JavaScript calendar widget; any consumer of the data from the form would see only the abstract data type Date. Remarkably, this form of abstraction is unsupported in almost all web frameworks, and not fully supported in any web framework of which we are aware.Formlets are defined in terms of Conor McBride’s idioms (also called applicative functors), a program structuring technique halfway between Moggi’s monads and Hughes’s arrows. We have implemented formlets in the Links programming language. The core functionality is implemented entirely in library code. In addition we offer syntactic sugar which makes formlets particularly easy to use.We show how to extend formlets to support validation by composing the underlying idiom with an additional idiom.
Original languageEnglish
Number of pages22
Publication statusPublished - 2007

Fingerprint

Dive into the research topics of 'An idiom’s guide to formlets'. Together they form a unique fingerprint.

Cite this