Modeling HTML in Haskell

  • Peter Thiemann
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1753)


We define HTML as an embedded domain specific language in Haskell. To this end, we have designed and implemented a combinator library which provides the means to create and modify HTML elements. Haskell’s type classes are employed to enforce well-formed HTML to a large degree. Haskell can then be used as a meta language to map structured documents to HTML, to define conditional content, to extract information from the documents, or to define entire web sites. We introduce container-passing style as a programming convention for the library. We also pinpoint some shortcomings of Haskell’s type system that make the task of this library’s implementor tedious.

Key words

embedded domain specific language HTML functional programming type classes 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Per Bjesse, Koen Claessen, Mary Sheeran, and Satnam Singh. Lava: Hardware design in Haskell. In Paul Hudak, editor, Proc. International Conference on Functional Programming 1998, pages 174–184, Baltimore, USA, September 1998. ACM Press, New York.CrossRefGoogle Scholar
  2. 2.
    Tim Bray, Jean Paoli, and C.M. Sperberg-MacQueen. Extensible markup language (xml) 1.0 (w3c recommendation)., feb 1998.
  3. 3.
    Daniel Cabeza and Manuel Hermenegildo. Www programming using computational logic systems (and the PiLLoW/CIAO library)., March 1997.
  4. 4.
    Allaire Corp. HomeSite.
  5. 5.
    Ralf S. Engelschall. Website meta language (wml).
  6. 6.
    Haskell98, a non-strict, purely functional language., December 1998.
  7. 7.
    John E. Hopcroft and Jeffrey D. Ullman. Introduction to automata theory, languages and computation. Addison-Wesley, 1979.Google Scholar
  8. 8.
    John Hughes. Generalising monads to arrows. Science of Computer Programming, 1999. To appear.Google Scholar
  9. 9.
    SoftQuad Software Inc. HoTMetaL.
  10. 10.
    Mark P. Jones. A theory of qualified types. In Bernd Krieg-Brückner, editor, Proc. 4th European Symposium on Programming’ 92, volume 582 of Lecture Notes in Computer Science, pages 287–306, Rennes, France, February 1992. Springer-Verlag.Google Scholar
  11. 11.
    Mark P. Jones. Gofer, Functional Programming Environment, June 1994. Version 2.30.Google Scholar
  12. 12.
    Mark P. Jones. Hugs Online — embracing functional programming. http://www., June 1999.
  13. 13.
    Sheng Liang, Paul Hudak, and Mark Jones. Monad transformers and modular interpreters. In Proc. 22nd Annual ACM Symposium on Principles of Programming Languages, pages 333–343, San Francisco, CA, January 1995. ACM Press.Google Scholar
  14. 14.
    Seng Wai Loke and Andrew Davison. Logic programming with the World-Wide Web. pages 235–245, Washington DC, USA, mar 1996.Google Scholar
  15. 15.
    Konstantin Läufer. Type classes with existential types. Journal of Functional Programming, 6(3):485–517, May 1996.zbMATHMathSciNetCrossRefGoogle Scholar
  16. 16.
    Konstantin Läufer and Martin Odersky. An extension of ML with first-class abstract types. In Proc. ACM SIGPLAN Workshop on ML and its Applications, pages 78–91, San Francisco, CA, June 1992.Google Scholar
  17. 17.
    John Matthews, John Launchbury, and Byron Cook. Microprocessor specification in Hawk. In IEEE International Conference on Computer Languages, ICCL 1998, Chicago, USA, May 1998. IEEE Computer Society Press.Google Scholar
  18. 18.
    Erik Meijer. Server-side web scripting with Haskell. Journal of Functional Programming, 1999. To appear.Google Scholar
  19. 19.
    Microsoft. Microsoft Frontpage98.
  20. 20.
    NetObjects Fusion.
  21. 21.
    J. K. OusterHout. Tcl and the Tk Toolkit. Addison-Wesley, 1994.Google Scholar
  22. 22.
    PC Magazine. Web authoring tools., January 20 1998.
  23. 23.
    John Punin and Mukkai Krishnamoorthy. ASHE (a simple HTML editor) — xhtml. URL }, November 1996.Google Scholar
  24. 24.
    Didier Rémy. Typing record concatenation for free. In Proc. 19th Annual ACM Symposium on Principles of Programming Languages, pages 166–176, Albuquerque, New Mexico, January 1992. ACM Press.Google Scholar
  25. 25.
    Internet Software Technologies. HTMLed Pro32.
  26. 26.
  27. 27.
    Ton Vullinghs, Wolfram Schulte, and Thilo Schwinn. The design of a functional GUI library using constructor classes. In PSI-96: Andrei Ershov Second International Memorial Conference, Perspectives of System Informatics, volume 1181 of Lecture Notes in Computer Science, pages 398–408, Novosibirsk, Russia, June 1996. Springer-Verlag.Google Scholar
  28. 28.
    Ton Vullinghs, Daniel Tuijnman, and Wolfram Schulte. Lightweight GUIs for functional programming. In Doaitse Swierstra and Manuel Hermenegildo, editors, International Symposium on Programming Languages, Implementations, Logics and Programs (PLILP’ 95), volume 982 of Lecture Notes in Computer Science, pages 341–356, Utrecht, The Netherlands, September 1995. Springer-Verlag.CrossRefGoogle Scholar
  29. 29.
    Malcolm Wallace and Colin Runciman. Haskell and XML: Generic combinators or type-based translation? pages 148–259.Google Scholar
  30. 30.
    Mitchell Wand. Type inference for record concatenation and multiple inheritance. In Proc. of the 4th Annual Symposium on Logic in Computer Science, pages 92–97, Pacific Grove, CA, June 1989. IEEE Computer Society Press. To appear in Information and Computation.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1999

Authors and Affiliations

  • Peter Thiemann
    • 1
  1. 1.Universität FreiburgGermany

Personalised recommendations