Yesterday, Matthias Felleisen wrote: > > I know > > What I mean is an _abstraction mechanism_ inside of TR. Possibly > something that nobody else has.
+18.59 And a quick reminder -- below is the ancient hack I once did for such things, maybe something like this would be easier now. Possibly much easier: if a type is (foo ...) and `foo' is phase-1-bound to a macro (anything that is not a bound type), then just expand it -- so that in Neil's case the code could be: (define-syntax-rule (Xs->Xs T ...) (case-> (T -> T) ...)) (: foo : (Xs->Xs Zero Flonum Real Float-Complex Complex)) (Either way, this means that it's easy to create huge types, and therefore stressing TR's not-too-fast typechecker, but it sounds like not having an abstraction doesn't stand in Neil's way to write huge types anyway.) ------------------------------------------------------------------------ #lang typed-scheme (require (for-syntax scheme/base scheme/private/at-syntax)) ;; (define-syntax (STX stx) ;; (syntax-case stx () ;; [(_ expr) (at-syntax #'expr)])) (define-syntax (:: stx) (syntax-case stx (:) [(_ name : x ...) (with-syntax ([(x ...) (map at-syntax (syntax->list #'(x ...)))]) #`(: name : x ...))])) (define-for-syntax Number #'Number) (define-for-syntax (T1 . -> . T2) #`(#,T1 -> #,T2)) (:: twice : (let ([n (Number . -> . Number)]) (n . -> . n))) (define (twice f) (lambda (x) (f (f x)))) ((twice add1) 10) -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! _________________________ Racket Developers list: http://lists.racket-lang.org/dev