Random improvement.

The thing that caught my eye is the missing `#:cache-keys?' which should
really be there.  But not too important.

original commit: eaa6f85054c5c404507e5c9cbab0d3e93f468370
This commit is contained in:
Eli Barzilay 2014-09-21 00:07:08 -04:00 committed by Asumu Takikawa
parent 0674c1638e
commit 2ff47d2e06

View File

@ -58,16 +58,12 @@
;; does t have a type name associated with it currently?
;; has-name : Type -> Maybe[Listof<Symbol>]
(define (has-name? t)
(cond
[print-aliases
(define candidates
(for/list ([(n t*) (in-pairs (in-list (force (current-type-names))))]
#:when (and (Type? t*) (type-equal? t t*)))
n))
(if (null? candidates)
#f
(sort candidates string>? #:key symbol->string))]
[else #f]))
(define candidates
(for/list ([(n t*) (in-pairs (in-list (force (current-type-names))))]
#:when (and print-aliases (Type? t*) (type-equal? t t*)))
n))
(and (pair? candidates)
(sort candidates string>? #:key symbol->string #:cache-keys? #t)))
;; print-<thing> : <thing> Output-Port Boolean -> Void
;; print-type also takes an optional (Listof Symbol)