问题描述
示例:
(: trick (All (t u) ((U t (listof u)) -> (listof u))))
(define (trick x)
(cond
[(list? x) x]
)
)
此 n
类型的错误:
Type Checker: type mismatch
expected: (listof u)
given: (U (listof u) (∩ (Pairof Any (listof Any)) t)) in: x
我尝试用 n
编写类型签名,并在 Dr. Racket 中使用 go-to-deFinition,但它说找不到符号。
解决方法
不是n
,而是∩
(intersection)。