Only suggest using :print-type once per REPL session.
This commit is contained in:
parent
3ba93cb165
commit
dcff8854fb
|
@ -42,6 +42,7 @@
|
||||||
;; use the regular %#module-begin from `racket/base' for top-level printing
|
;; use the regular %#module-begin from `racket/base' for top-level printing
|
||||||
(arm #`(#%module-begin optimized-body ... #,after-code check-syntax-help))))))]))
|
(arm #`(#%module-begin optimized-body ... #,after-code check-syntax-help))))))]))
|
||||||
|
|
||||||
|
(define did-I-suggest-:print-type-already? #f)
|
||||||
(define (ti-core stx)
|
(define (ti-core stx)
|
||||||
(syntax-parse stx
|
(syntax-parse stx
|
||||||
[(_ . ((~datum module) . rest))
|
[(_ . ((~datum module) . rest))
|
||||||
|
@ -62,17 +63,22 @@
|
||||||
;; Don't display the whole types at the REPL. Some case-lambda types
|
;; Don't display the whole types at the REPL. Some case-lambda types
|
||||||
;; are just too large to print.
|
;; are just too large to print.
|
||||||
(let ([tc (cleanup-type t)])
|
(let ([tc (cleanup-type t)])
|
||||||
(format "- : ~a~a\n" tc (if (equal? tc t)
|
(format "- : ~a~a\n"
|
||||||
|
tc (if (or did-I-suggest-:print-type-already?
|
||||||
|
(equal? tc t))
|
||||||
""
|
""
|
||||||
"\nUse :print-type to see more.")))]
|
(begin (set! did-I-suggest-:print-type-already? #t)
|
||||||
|
"\nUse :print-type to see more."))))]
|
||||||
[(tc-results: t)
|
[(tc-results: t)
|
||||||
(define new-ts (map cleanup-type t))
|
(define new-ts (map cleanup-type t))
|
||||||
(format "- : ~a~a\n"
|
(format "- : ~a~a\n"
|
||||||
(cons 'Values new-ts)
|
(cons 'Values new-ts)
|
||||||
;; did any get pruned?
|
;; did any get pruned?
|
||||||
(if (not (andmap equal? t new-ts))
|
(if (or did-I-suggest-:print-type-already?
|
||||||
" \nUse :print-type to see more."
|
(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)])])
|
[x (int-err "bad type result: ~a" x)])])
|
||||||
(if ty-str
|
(if ty-str
|
||||||
#`(let ([type '#,ty-str])
|
#`(let ([type '#,ty-str])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user