(define impc:ti:construct-generic-type-if-valid
(lambda (t)
;; named type might need to be constructed!
(if (and (string? t)
(char=? (string-ref t 0) #\%)
(regex:match? t "_poly_"))
(if (impc:ti:namedtype-exists? t)
#t ;; if 't' exists don't do anything else
(let* ((p (regex:split t "_poly_"))
(n (substring (car p) 1 (string-length (car p)))))
(if (not (impc:ti:get-generictype-candidate-types n))
#f ;; if not a generic type then bad :(
(begin
#t))))
#t)))