Ruler: Programming Type Rules

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.

[1]  Benjamin C. Pierce,et al.  Types and programming languages: the next generation , 2003, 18th Annual IEEE Symposium of Logic in Computer Science, 2003. Proceedings..

[2]  Dominic Duggan,et al.  Type-checking multi-parameter type classes , 2002, J. Funct. Program..

[3]  David Aspinall,et al.  Formalising Java's Data Race Free Guarantee , 2007, TPHOLs.

[4]  Karl-Filip Faxén,et al.  A static semantics for Haskell , 2002, Journal of Functional Programming.

[5]  Peyton Jones,et al.  Haskell 98 language and libraries : the revised report , 2003 .

[6]  Thomas Johnsson,et al.  Attribute grammars as a functional programming paradigm , 1987, FPCA.

[7]  Donald E. Knuth,et al.  Literate Programming , 1984, Comput. J..

[8]  Mark P. Jones Qualified Types: Theory and Practice , 1994 .

[9]  Simon Peyton Jones,et al.  Lightweight Extensible Records for Haskell , 1999 .

[10]  Benjamin C. Pierce,et al.  Mechanized Metatheory for the Masses: The PoplMark Challenge , 2005, TPHOLs.

[11]  Eelco Visser,et al.  Program Transformation with Stratego/XT: Rules, Strategies, Tools, and Systems in Stratego/XT 0.9 , 2003, Domain-Specific Program Generation.

[12]  Mark P. Jones,et al.  Typing Haskell in Haskell , 1999 .

[13]  S. Doaitse Swierstra,et al.  Typing Haskell with an Attribute Grammar , 2004, Advanced Functional Programming.

[14]  Philip Wadler XQuery: A Typed Functional Language for Querying XML , 2002, Advanced Functional Programming.

[15]  Richard S. Bird Using circular programs to eliminate multiple traversals of data , 2004, Acta Informatica.

[16]  Atze Dijkstra Stepping through Haskell , 2000 .

[17]  Karl-Filip Faxén Haskell and principal types , 2003, Haskell '03.

[18]  Jurriaan Hage,et al.  Type Class Directives , 2005, PADL.

[19]  S. D. Swierstra,et al.  Explicit implicit parameters , 2004 .

[20]  Benedict R. Gaster,et al.  A Polymorphic Type System for Extensible Records and Variants , 1996 .

[21]  Benjamin C. Pierce,et al.  TinkerType: a language for playing with formal systems , 2003, Journal of Functional Programming.

[22]  D. J. Allerton,et al.  Book Review: GPS theory and practice. Second Edition, HOFFMANNWELLENHOFF B., LICHTENEGGER H. and COLLINS J., 1993, 326 pp., Springer, £31.00 pb, ISBN 3-211-82477-4 , 1995 .

[23]  Jurriaan Hage,et al.  Generalizing Hindley-Milner Type Inference Algorithms , 2002 .

[24]  Simon Peyton Jones,et al.  Type classes: an exploration of the design space , 1997 .

[25]  A. Dijkstra,et al.  Making Implicit Parameters Explicit , 2005 .