diff --git a/test/test-traversal-1.rkt b/test/test-traversal-1.rkt index 7284760..2775468 100644 --- a/test/test-traversal-1.rkt +++ b/test/test-traversal-1.rkt @@ -1,6 +1,6 @@ #lang type-expander -(require "../traversal.hl.rkt" +(require "traversal-util.rkt" ;"../traversal.hl.rkt" "ck.rkt") (define-type Foo (Listof String)) diff --git a/test/test-traversal-2.rkt b/test/test-traversal-2.rkt index 1c4c54d..8d3296f 100644 --- a/test/test-traversal-2.rkt +++ b/test/test-traversal-2.rkt @@ -1,6 +1,6 @@ #lang typed/racket -(require "../traversal.hl.rkt" +(require "traversal-util.rkt" ;"../traversal.hl.rkt" type-expander phc-adt "ck.rkt" diff --git a/test/traversal-util.rkt b/test/traversal-util.rkt new file mode 100644 index 0000000..7aef472 --- /dev/null +++ b/test/traversal-util.rkt @@ -0,0 +1,22 @@ +#lang typed/racket +(require (for-syntax syntax/parse + syntax/parse/experimental/template + type-expander/expander) + "../traversal.hl.rkt") + +(provide define-fold) + +(define-syntax define-fold + (syntax-parser + [(_ _function-name:id + _type-name:id + whole-type:type + _type-to-replaceᵢ:type ...) + (with-folds + (λ () + (template + (begin + (define-type _type-name + (∀-replace-in-type whole-type _type-to-replaceᵢ ...)) + (define _function-name + (λ-replace-in-instance whole-type _type-to-replaceᵢ ...))))))])) \ No newline at end of file diff --git a/traversal.hl.rkt b/traversal.hl.rkt index 91662c9..2ffb573 100644 --- a/traversal.hl.rkt +++ b/traversal.hl.rkt @@ -389,7 +389,7 @@ where @racket[foldl-map] is defined as: (for-meta 2 phc-toolkit/untyped) (for-meta 2 syntax/parse)) - (provide define-fold + (provide with-folds (for-syntax replace-in-instance) (for-syntax replace-in-type))