Only suggest using :print-type once per REPL session.

original commit: dcff8854fb495542bed73a9b381bb0867bbfe683
This commit is contained in:
Vincent St-Amour 2011-07-22 17:03:43 -04:00
parent 66c483ea60
commit ccda7b859c

View File

@ -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])