Advertisement

Building JavaScript Applications with Haskell

  • Atze DijkstraEmail author
  • Jurriën Stutterheim
  • Alessandro Vermeulen
  • S. Doaitse Swierstra
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8241)

Abstract

We introduce the Utrecht Haskell Compiler JavaScript backend, which allows one to compile Haskell code to JavaScript, so it can be run in the browser. To interface with JavaScript and overcome part of the impedance mismatch between the two languages, we introduce the Foreign Expression Language; a small subset of JavaScript for use in Foreign Function Interface imports. Finally we discuss the implementation of a JavaScript application, completely written in Haskell, with which we show that it is now possible to write an entire JavaScript application completely in Haskell.

Keywords

Compilation FFI Web applications Haskell JavaScript 

References

  1. 1.
  2. 2.
  3. 3.
  4. 4.
    A Haskell interpreter in JavaScript. https://github.com/johang88/haskellinjavascript (2010)
  5. 5.
  6. 6.
  7. 7.
    Ashkenas, J.: CoffeeScript. http://coffeescript.org/
  8. 8.
    Bruël, E., Jansen, J.M.: Implementing a non-strict purely Functional Language in JavaScript. In: Implementation of Functional Languages (2010)Google Scholar
  9. 9.
    Dijkstra, A., Fokker, J., Swierstra, S.D.: The Architecture of the Utrecht Haskell Compiler. In: Haskell Symposium (2009)Google Scholar
  10. 10.
    Dijkstra, A., Fokker, J., Swierstra, S.D.: UHC Utrecht Haskell Compiler. http://www.cs.uu.nl/wiki/UHC (2009)
  11. 11.
    Done, C.: Fay programming language. http://fay-lang.org/
  12. 12.
    ECMA International, Geneva, Switzerland. ECMAScript Language Specification. http://www.ecma-international.org/publications/standards/Ecma-262.htm (2011)
  13. 13.
    Ekblad, A.: Towards a declarative web. Master’s thesis, University of Gothenburg, Chalmers University of Technology, Department of Computer Science and Engineering, Göteborg, Sweden (2012) (To appear) http://ekblad.cc/hastereport.pdf
  14. 14.
    Elliott, C.M.: Push-pull functional reactive programming. In: Proceedings of the 2nd ACM SIGPLAN Symposium on Haskell, Haskell ’09, pp. 25–36. ACM, New York (2009)Google Scholar
  15. 15.
    Epstein, J., Black, A.P., PeytonJones, S.: Towards Haskell in the Cloud (2011)Google Scholar
  16. 16.
    Hofmann, M., Pierce, B., Wagner, D.: Symmetric lenses. SIGPLAN Not. 46(1), 371–384 (2011)CrossRefGoogle Scholar
  17. 17.
    Jansen, J.M.: Functional web applications, implementation and use of client-side interpreters. Ph.D. thesis, Radboud University Nijmegen (2010)Google Scholar
  18. 18.
    Jones, S.P. (ed.): Haskell 98 Language and Libraries: The Revised Report. http://haskell.org/, September 2002
  19. 19.
    Kagawa, K.: Compositional references for stateful functional programming. SIGPLAN Not. 32(8), 217–226 (1997)CrossRefGoogle Scholar
  20. 20.
    Leijen, D.: wxHaskell: A portable and concise GUI library for Haskell. In: Proceedings of the 2004 ACM SIGPLAN Workshop on Haskell, Haskell ’04, pages 57–68. ACM, New York (2004)Google Scholar
  21. 21.
    Mackenzie, H., Nazarov, V., Stegeman, L.: GHCJS: Haskell to JavaScript translator. https://github.com/ghcjs/ghcjs/tree/gen2 (2012)
  22. 22.
    Miller, P., Graf, N., Schranz, T., Gerstmayr, A.: Brunch. IO. http://brunch.io/
  23. 23.
    Nazarov, V.: GHCJS: Haskell to Javascript compiler (via GHC). https://github.com/ghcjs/ghcjs (2011)
  24. 24.
    Plasmeijer, R., Jansen, J.M., Koopman, P.: Declarative Ajax and Client Side Evaluation of Workflows using iTasks. In: Principles and Practice of Declarative Programming (2008)Google Scholar
  25. 25.
    Podolsky, O.: jquery-ajaxq. http://code.google.com/p/jquery-ajaxq/
  26. 26.
    Resig, J.: jQuery. http://jquery.com
  27. 27.
    Steele, O.: Functional JavaScript. http://osteele.com/sources/javascript/functional/ (2007)
  28. 28.
    Stutterheim, J., Swierstra, W., Swierstra, D.: Forty hours of declarative programming - Teaching Prolog at the Junior College Utrecht (2012)Google Scholar
  29. 29.
    Stutterheim, J., Vermeulen, A., Dijkstra, A.: UHC-JavaScript libraries. https://github.com/UU-ComputerScience/uhc-js
  30. 30.
    Swierstra, D., Stutterheim, J.: NanoProlog package. http://hackage.haskell.org/package/NanoProlog
  31. 31.
    Swierstra, W., Doaitse Swierstra, S., Stutterheim, J.: Logisch en Functioneel Programmeren voor Wiskunde D. Technical Report UU-CS-2011-033, Universiteit Utrecht (2011)Google Scholar
  32. 32.
    Wan, Z., Hudak, P.: Functional reactive programming from first principles. In: Proceedings of the ACM SIGPLAN 2000 Conference on Programming Language Design and Implementation, PLDI ’00, pp. 242–252. ACM, New York (2000)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Atze Dijkstra
    • 1
    Email author
  • Jurriën Stutterheim
    • 1
  • Alessandro Vermeulen
    • 1
  • S. Doaitse Swierstra
    • 1
  1. 1.Department of Information and Computing Sciences22 Universiteit UtrechtUtrechtThe Netherlands

Personalised recommendations