phc-graph/test/traversal-util.rkt
Georges Dupéron 3458175b0c Cleanup
2016-11-10 18:17:04 +01:00

22 lines
660 B
Racket

#lang typed/racket
(require (for-syntax syntax/parse
backport-template-pr1514/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ᵢ ...))))))]))