Based on Asumu's work on type expanders (https://github.com/racket/racket/compare/master...takikawa:tr-type-expander), I have written a library which adds support for type expanders in typed/racket. Type expanders are to types what match expanders are to match patterns. A type expander is a special macro which can appear wherever a type would normally be expected, and must expand to a type.
The library is written using literate programming, with (a variant of) scribble/lp2. The annotated source code is available here: http://docs.racket-lang.org/type-expander.hl/ and the documentation here: http://docs.racket-lang.org/type-expander/ This library comes along with the multi-id library (http://docs.racket-lang.org/multi-id/, literate source: http://docs.racket-lang.org/multi-id.hl/), which allows easy definition of an identifier which acts as a type expander, match expander, normal macro and identifier macro. It can be used to define new datatypes, where a single identifier represents the type, match clause, literal instance as in (foo-datatype 1 2 3), and constructor function as in (map foo-datatype …). The type-expander library is in beta status: * It works well and I have been using it for a while without issues. * The API should not change significantly in the future. * However, there are many typed/racket primitives which are not overloaded yet, as noted in the documentation (patches are welcome). * Also, a couple of features are missing (patches are welcome again): * The special form `Let`, which acts like `let-syntax` for types, is only partially implemented. * The special form `(Λ (stx) . body)`, which acts as an anonymous type expander, is not implemented at all. * There is no syntax-local-type-introduce. Any feedback is appreciated! :) Regards, Georges Dupéron -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.