J. Bracker and A. Gill, “Sunroof: A monadic DSL for generating JavaScript,” in Practical Aspects of Declarative Languages, ser. Lecture Notes in Computer Science, M. Flatt and H.-F. Guo, Eds. Springer International Publishing, 2014, vol. 8324, pp. 65–80.

Links

Abstract

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.

BibTeX

@incollection{Bracker:14:Sunroof,
  year = {2014},
  isbn = {978-3-319-04131-5},
  booktitle = {Practical Aspects of Declarative Languages},
  volume = {8324},
  series = {Lecture Notes in Computer Science},
  editor = {Flatt, Matthew and Guo, Hai-Feng},
  doi = {10.1007/978-3-319-04132-2_5},
  title = {Sunroof: A Monadic {DSL} for Generating {J}ava{S}cript},
  publisher = {Springer International Publishing},
  keywords = {DSLs; JavaScript; Web Technologies; Cloud Computing},
  author = {Bracker, Jan and Gill, Andy},
  pages = {65-80},
}