diff --git a/collects/typed-scheme/rep/rep-utils.rkt b/collects/typed-scheme/rep/rep-utils.rkt index 3e3cc464a3..ade55c9fdf 100644 --- a/collects/typed-scheme/rep/rep-utils.rkt +++ b/collects/typed-scheme/rep/rep-utils.rkt @@ -1,7 +1,7 @@ #lang scheme/base (require "../utils/utils.rkt") -(require mzlib/struct +(require mzlib/struct mzlib/pconvert scheme/match syntax/boundmap "free-variance.rkt" @@ -265,4 +265,20 @@ (apply maker (list-update flds idx new-val))) (define (replace-syntax rep stx) - (replace-field rep stx 3)) \ No newline at end of file + (replace-field rep stx 3)) + +(define (converter v basic sub) + (define (gen-constructor sym) + (string->symbol (string-append "make-" (substring (symbol->string sym) 7)))) + (match v + [(? (lambda (e) (or (Filter? e) + (Object? e) + (PathElem? e))) + (app (lambda (v) (vector->list (struct->vector v))) (list-rest tag seq fv fi stx vals))) + `(,(gen-constructor tag) ,@(map sub vals))] + [(? Type? + (app (lambda (v) (vector->list (struct->vector v))) (list-rest tag seq fv fi stx key vals))) + `(,(gen-constructor tag) ,@(map sub vals))] + [_ (basic v)])) + +(current-print-convert-hook converter) \ No newline at end of file diff --git a/collects/typed-scheme/utils/utils.rkt b/collects/typed-scheme/utils/utils.rkt index b6d9364b5d..493ab95a02 100644 --- a/collects/typed-scheme/utils/utils.rkt +++ b/collects/typed-scheme/utils/utils.rkt @@ -139,15 +139,12 @@ at least theoretically. print-type* print-filter* print-latentfilter* print-object* print-latentobject* print-pathelem*) -(define pseudo-printer - (lambda (s port mode) - (parameterize ([current-output-port port] - [show-sharing #f] - [booleans-as-true/false #f] - [constructor-style-printing #t]) - (newline) - (pretty-print (print-convert s)) - (newline)))) +(define (pseudo-printer s port mode) + (parameterize ([current-output-port port] + [show-sharing #f] + [booleans-as-true/false #f] + [constructor-style-printing #t]) + (pretty-print (print-convert s)))) (define custom-printer (make-parameter #t))