Ruler: Programming Type Rules

  • Atze Dijkstra
  • S. Doaitse Swierstra
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3945)


Some type systems are first described formally, to be sometimes followed by an implementation. Other type systems are first implemented as language extensions, to be sometimes retrofitted with a formal description. In neither case it is an easy task to keep both artefacts consistent. In this paper we introduce Ruler, a domain specific language for describing type rules. Type rules can be incrementally described, thus providing a means for building complex type systems on top of simpler ones. Besides checking well-formedness of Ruler programs we use them to generate (1) a visual LATEX rendering, suitable for use in the presentation of formal aspects, and (2) an attribute grammar based implementation. Combining these two aspects in Ruler contributes to bridging the gap between theory and practice: mutually consistent representations can be generated for use in both theoretical and practical settings.


Type System Theorem Prove Algorithmic Version Ruler System Type Rule 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Projet CROAP. Design and Implementaiton of Programming Tools (1999),
  2. 2.
    Hugs 1998 (2003),
  3. 3.
  4. 4.
    Literate Programming (2005),
  5. 5.
    Aydemir, B.E., Bohannon, A., Fairbairn, M., Foster, J.N., Pierce, B.C.: Mechanized metatheory for the masses: The POPLmark challenge. In: Hurd, J., Melham, T. (eds.) TPHOLs 2005. LNCS, vol. 3603, pp. 50–65. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  6. 6.
    Dijkstra, A.: EHC Web (2004),
  7. 7.
    Dijkstra, A.: Stepping through Haskell. PhD thesis, Utrecht University, Department of Information and Computing Sciences (2005)Google Scholar
  8. 8.
    Dijkstra, A., Swierstra, S.D.: Typing Haskell with an Attribute Grammar. In: Vene, V., Uustalu, T. (eds.) AFP 2004. LNCS, vol. 3622, pp. 1–72. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  9. 9.
    Dijkstra, A., Doaitse Swierstra, S.: Making Implicit Parameters Explicit. Technical report, Utrecht University (2005)Google Scholar
  10. 10.
    Duggan, D., Ophel, J.: Type-Checking Multi-Parameter Type Classes. Journal of Functional Programming (2002)Google Scholar
  11. 11.
    Faxen, K.-F.: A Static Semantics for Haskell. Journal of Functional Programming 12(4), 295 (2002)MathSciNetMATHGoogle Scholar
  12. 12.
    GrammaTech. Synthesizer Generator (2005),
  13. 13.
    Harper, R.: Mechanizing Language Definitions (invited lecture at ICFP 2005) (2005),
  14. 14.
    Heeren, B., Hage, J.: Type Class Directives. In: Hermenegildo, M.V., Cabeza, D. (eds.) PADL 2004. LNCS, vol. 3350, pp. 253–267. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  15. 15.
    Heeren, B., Hage, J., Swierstra, S.D.: Generalizing Hindley-Milner Type Inference Algorithms. Technical Report UU-CS-2002-031, Institute of Information and Computing Science, University Utrecht, Netherlands (2002)Google Scholar
  16. 16.
    Jones, M.P.: Qualified Types, Theory and Practice. Cambridge Univ. Press, Cambridge (1994)CrossRefMATHGoogle Scholar
  17. 17.
    Jones, M.P.: Typing Haskell in Haskell (2000),
  18. 18.
    Levin, M.Y., Pierce, B.C.: TinkerType: A Language for Playing with Formal Systems (1999),
  19. 19.
    Marlow, S.: The Glasgow Haskell Compiler (2004),
  20. 20.
    Jones, S.P.: Haskell 1998, Language and Libraries, The Revised Report. Cambridge Univ. Press, Cambridge (2003)Google Scholar
  21. 21.
    Jones, S.P., Jones, M., Meijer, E.: Type classes: an exploration of the design space. In: Haskell Workshop (1997)Google Scholar
  22. 22.
    Pierce, B.C.: Types and Programming Languages. MIT Press, Cambridge (2002)MATHGoogle Scholar
  23. 23.
    Simmons, R.: The Twelf Project, Wiki Home (2005),
  24. 24.
    Visser, E.: Stratego Home Page (2005),

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Atze Dijkstra
    • 1
  • S. Doaitse Swierstra
    • 1
  1. 1.Department of Information and Computing SciencesUniversiteit UtrechtUtrechtNetherlands

Personalised recommendations