On this page:
Type expander:   Implementation
7.1

Type expander: Implementation

Georges Dupéron <[email protected]>

This library is implemented using literate programming. The implementation details are presented in the following sections. The user documentation is in the Type expander library document.

    1 Implementation of the type expander library

      1.1 Introduction

      1.2 Expansion model for type expanders

        1.2.1 Comparison with TeX’s macro expansion model

        1.2.2 Interactions between type expanders and scopes

      1.3 The prop:type-expander structure type property

        1.3.1 The type-expander struct

      1.4 Associating type expanders to identifiers

        1.4.1 The type-expander syntax class

        1.4.2 Calling type expanders

        1.4.3 Associating type expanders to already existing identifiers

        1.4.4 Defining new type expanders

        1.4.5 Locally binding type expanders

      1.5 Expanding types

        1.5.1 Cases handled by expand-type

        1.5.2 Applying type expanders

          1.5.2.1 Polymorphic types with

          1.5.2.2 Recursive types with Rec

          1.5.2.3 Local bindings with Let and Letrec

          1.5.2.4 Anonymous types with Λ

          1.5.2.5 Preventing the expansion of types with No-Expand

          1.5.2.6 The overloaded : identifier

          1.5.2.7 Last resort cases: leaving the type unchanged

        1.5.3 Debugging type expanders

      1.6 Overloading typed/racket forms

        1.6.1 syntax classes

        1.6.2 Overview of the overloaded primitives

        1.6.3 :

        1.6.4 define-type

        1.6.5 define

        1.6.6 lambda

        1.6.7 case-lambda

        1.6.8 struct

        1.6.9 define-struct/exec

        1.6.10 ann

        1.6.11 cast

        1.6.12 unsafe-cast

        1.6.13 inst

        1.6.14 row-inst

        1.6.15 let

        1.6.16 let*

        1.6.17 let-values

        1.6.18 make-predicate

        1.6.19 :type, :print-type, :query-type/args, :query-type/result

        1.6.20 Type expanders for the typed classes

        1.6.21 Other typed/racket forms

      1.7 Future work

      1.8 Conclusion

    2 Some example type expanders

      2.1 Example type expanders: quasiquote and quasisyntax

      2.2 Implementation of the Let* special type expander form

      2.3 curry

      2.4 Putting it all together