Sunroof: A Monadic DSL for Generating JavaScript

  • Jan Bracker
  • Andy Gill
Conference paper

DOI: 10.1007/978-3-319-04132-2_5

Part of the Lecture Notes in Computer Science book series (LNCS, volume 8324)
Cite this paper as:
Bracker J., Gill A. (2014) Sunroof: A Monadic DSL for Generating JavaScript. In: Flatt M., Guo HF. (eds) Practical Aspects of Declarative Languages. PADL 2014. Lecture Notes in Computer Science, vol 8324. Springer, Cham


Sunroof is a Haskell-hosted Domain Specific Language (DSL) for generating JavaScript. The central feature of Sunroof is a JavaScript monad, which, like the Haskell IO-monad, allows access to external resources, but specifically JavaScript resources. As such, Sunroof is primarily a feature-rich foreign-function API to the browser’s JavaScript engine, and all the browser-specific functionality, including HTML-based rendering, event handling, and drawing to the HTML5 canvas element.

In this paper, we give the design and implementation of Sunroof. Using monadic reification, we generate JavaScript from a deep embedding of the JavaScript monad. The Sunroof DSL has the feel of native Haskell, with a simple Haskell-based type schema to guide the Sunroof programmer. Furthermore, because we are generating code, we can offer Haskell-style concurrency patterns, such as MVars and Channels. In combination with a web-services package, the Sunroof DSL offers a robust platform to build interactive web applications.


DSLs JavaScript Web Technologies Cloud Computing 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Copyright information

© Springer International Publishing Switzerland 2014

Authors and Affiliations

  • Jan Bracker
    • 1
  • Andy Gill
    • 2
  1. 1.Institut für InformatikChristian-Albrechts-UniversitätKielGermany
  2. 2.ITTC / EECSThe University of KansasLawrenceUSA

Personalised recommendations