From ccda7b859ca4ea781c3e680b38b7f7755593d6e8 Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Fri, 22 Jul 2011 17:03:43 -0400 Subject: [PATCH] Only suggest using :print-type once per REPL session. original commit: dcff8854fb495542bed73a9b381bb0867bbfe683 --- collects/typed-scheme/core.rkt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/collects/typed-scheme/core.rkt b/collects/typed-scheme/core.rkt index 190932dd..37052281 100644 --- a/collects/typed-scheme/core.rkt +++ b/collects/typed-scheme/core.rkt @@ -42,6 +42,7 @@ ;; use the regular %#module-begin from `racket/base' for top-level printing (arm #`(#%module-begin optimized-body ... #,after-code check-syntax-help))))))])) +(define did-I-suggest-:print-type-already? #f) (define (ti-core stx) (syntax-parse stx [(_ . ((~datum module) . rest)) @@ -62,17 +63,22 @@ ;; Don't display the whole types at the REPL. Some case-lambda types ;; are just too large to print. (let ([tc (cleanup-type t)]) - (format "- : ~a~a\n" tc (if (equal? tc t) - "" - "\nUse :print-type to see more.")))] + (format "- : ~a~a\n" + tc (if (or did-I-suggest-:print-type-already? + (equal? tc t)) + "" + (begin (set! did-I-suggest-:print-type-already? #t) + "\nUse :print-type to see more."))))] [(tc-results: t) (define new-ts (map cleanup-type t)) (format "- : ~a~a\n" (cons 'Values new-ts) ;; did any get pruned? - (if (not (andmap equal? t new-ts)) - " \nUse :print-type to see more." - ""))] + (if (or did-I-suggest-:print-type-already? + (andmap equal? t new-ts)) + "" + (begin (set! did-I-suggest-:print-type-already? #t) + " \nUse :print-type to see more.")))] [x (int-err "bad type result: ~a" x)])]) (if ty-str #`(let ([type '#,ty-str])